public static void addSalesOrderDiscountCodes(XppPrePostArgs _args) { Microsoft.Dynamics.Commerce.Runtime.DataModel.SalesTransaction crtSalesTransaction = _args.getReturnValue(); CLRObject discountCodesList; RetailSalesOrderCalculator retailSalesOrderCalculator = _args.getThis(); SalesId salesId = retailSalesOrderCalculator.getSalesId(); SalesTableDiscountCodes salesTableDiscountCodes; if (salesId) { discountCodesList = crtSalesTransaction.get_DiscountCodes(); while select DiscountCode from salesTableDiscountCodes where salesTableDiscountCodes.SalesId == salesId { discountCodesList.Add(salesTableDiscountCodes.DiscountCode); } crtSalesTransaction.set_DiscountCodes(discountCodesList); _args.setReturnValue(crtSalesTransaction); } }SalesTableDiscountCodes is new table which contains 2 fields:
protected SalesId getSalesId() { return salesId; }3. You also should provide a way to edit SalesTableDiscountCodes table. Basically it could be simple list form which can be shown from SalesTable form.
DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.
Authors are allowed to set their own AdSense units.
Join us.