Update record after record insert in table

Update record after record insert in table

MCP · Azure DevOpsYour delivery board, readable by an agentMCP · DataverseOne consent, and the data layer opensMCP · Dynamics 365 F&OConnecting F&O to an agent Microsoft hasn’t documented
Archive recovery note: the supplied Blogspot backup did not contain a separate saved page for this older entry. The text available in its archive/listing capture has been preserved and flagged for a later completeness check.
If you are getting the following error while inserting and updating records. Cannot edit a record in Table (Tablename). An update conflict occurred due to another user process deleting the record or changing one or more fields in the record. You will be doing it in this way; 1. Table table; 2. ; 3. table.Field1 = 'A' ; 4. table.insert(); 5. 6. table.Field2 = 'Desc' ; 7. table.update(); To avoid such cases: 01. Table table; 02. ; 03. ttsbegin; 04. table.Field1 = 'A' ; 05. table.insert(); 06. 07. table.Field2 = 'Desc' ; 08. table.update(); 09. ttscommit; Or this way: 01. Table table; 02. ; 03. table.Field1 = 'A' ; 04. table.insert(); 05. 06. // time consuming other code here 07. 08. ttsbegin; 09. table.selectForUpdate( true ); 10. table.reread(); 11. table.Field2 = 'Desc' ; 12. table.update(); 13. ttscommit;
Previous article← List of “Whats New in Dynamics AX 2012″ Documents is Now on PartnerSource!
Discussion

Ask a question or leave feedback

This is a review interaction. The WordPress version will store, thread and moderate comments.

Thanks — submitted for moderation in this review.
Search the whole site · Ctrl/⌘ + K