Posts

Showing posts with the label ttsBegin

AX 2012 - Update must be performed inside a transaction

Image
Hi Readers, Many times you might have seen below error while you were updating or inserting data using X++. Error: Update must be performed inside a transaction Solution: The solution for the above error is you must keep your updating or inserting code into ttsBegin and ttsCommit. Syntax: ttsBegin; // Your_Code ttsCommit; Example: Copy code from below: // Code written by Chirag Gupta static void updateRebateData(Args _args) {     PdsRebateTable          pdsRebateTable;     PdsRebateAgreement      pdsRebateAgreement;     PdsRebateAgreementLine  pdsRebateAgreementLine;     int                     counter = 0;         while select forUpdate pdsRebateAgreementLine         join pdsRebateAgreement             where pdsRebateAgreementLine.RebateAgr...