The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.

COMMIT Method (Database)

Ends the current write transaction.




When a codeunit begins, it automatically enables write transactions to be performed. When an AL code module completes, it automatically ends the write transaction by committing the updates made by the AL code.

This means that if you want the codeunit to perform a single write transaction, it is automatically handled for you. However, if you want the codeunit to perform multiple write transactions, you must use the COMMIT method to end one write transaction before you can start the next. The COMMIT method separates write transactions in an AL code module.


The following pseudo-code example contains two write transactions. When it begins, a write transaction is automatically started. Using the COMMIT method, you end the first write transaction and prepare for the second. When the code completes, the second write transaction automatically ends.

(AL Statements) // Transaction 1  
(AL Statements) // Transaction 2  

See Also

Database Methods