{"title":"Database.Commit() Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/database/database-commit-method/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/database/database-commit-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/database/database-commit-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Ends the current write transaction.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":96,"chars":114},{"level":2,"title":"Remarks","slug":"remarks","at":210,"chars":616},{"level":2,"title":"Example","slug":"example","at":826,"chars":431},{"level":2,"title":"Related information","slug":"related-information","at":1257,"chars":136}],"text":"> Version: _Available or changed with runtime version 1.0._\nEnds the current write transaction.\n## Syntax\n```al\n Database.Commit()\n```\n> NOTE\n> This method can be invoked without specifying the data type name.\n## Remarks\nDuring AL code execution, if a transaction is needed, the AL runtime automatically initializes it. At the completion of AL code execution, any transactions that are created are also automatically ended, committing any updates made by the AL code.\nThis means that if you want code execution to perform a single write transaction, it's automatically handled for you. However, if you want the code execution 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.\n## Example\nThe 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.\n```\nBeginWriteTransactions\n(AL Statements) // Transaction 1\nCommit();\n(AL Statements) // Transaction 2\nEndWriteTransactions\n```\n## Related information\ndatabase-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}