Thursday, January 25, 2018

x++ code for how to change common table to required table at run time in AX 2012


common _target; //Declaration


   dictTable = new DictTable(tableNum(VendInvoiceInfoLine));

            _target = dictTable.makeRecord();// here now common buffer is converted to VendInvoiceInfoLine 
            //below I'm using VendInvoiceInfoLine .initfrompurchline() through _target 

            _target.initFromPurchLine(purchline); 


            _target.(fieldnum(VendInvoiceInfoLine,defaultdimension)) = purchline.DefaultDimension;

            if(entity.ReceiveNow)

            {
                 //Assigning value on dixf insert update methoad

                _target.(fieldnum(VendInvoiceInfoLine, Receivenow)) = entity.ReceiveNow; 

                _target.(fieldnum(VendInvoiceInfoLine, LineAmount)) = entity.ReceiveNow * _target.(fieldnum(VendInvoiceInfoLine,PurchPrice));


            }

No comments:

Post a Comment

Export a copy of the standard user acceptance testing (UAT) database

 Reference link: Export a copy of the standard user acceptance testing (UAT) database - Finance & Operations | Dynamics 365 | Microsoft ...