Understanding the Update Method in D365 F&O: Implementation and Best Practices
Table of Content:
update method in D365 F&O
The update method updates the current record with the contents of the buffer. It also updates the appropriate system fields. The optional where clause specifies a condition that the update method tests as it processes each row of the table. Only those rows that test true against the condition are updated with the new values.
The following example selects the CustTable table for update. Only records where the value of the AccountNum field equals 4000 are updated. Because there is no call to next, and this example doesn't use a select while statement, only one record is updated. The value of the CreditMax field is changed to 5000.
CustTable custTable; ttsBegin; select forUpdate custTable where custTable.AccountNum == '4000'; custTable.CreditMax = 5000; custTable.update(); ttsCommit;