Commit Transaction
Learning Content
Last updated: July 21, 2026
Commit Transaction
The Commit Transaction stage is the point where Salesforce permanently saves all successful changes made during the current transaction. Once the transaction reaches this stage, every database operation that completed successfully becomes permanent and visible to other users and processes.
Before the commit, Salesforce treats all changes as part of a single unit of work. If an unhandled exception occurs anywhere in that unit, Salesforce rolls back the entire transaction. After the commit, however, those changes can no longer be rolled back automatically because they have already been written permanently to the database.
π‘ LearnFrenzy Insight
Imagine writing a document in a text editor.
You can make changes, undo them, or discard the document until you click Save. Once the document is saved successfully, those changes become permanent.
The Commit Transaction stage works in the same way. Before the commit, Salesforce can still undo the work. After the commit, the changes become permanent.
Where Does Commit Transaction Execute?
Database Save
β
βΌ
After Trigger
β
βΌ
Workflow / Flow
β
βΌ
Roll-Up Summary
β
βΌ
β Commit Transaction
β
βΌ
Post-Commit Logic
Commit Transaction marks the end of Salesforce's main database transaction. Once it completes successfully, Salesforce begins executing post-commit operations that no longer participate in the original transaction.
What Happens During Commit Transaction?
| Step | Description |
|---|---|
| 1 | Salesforce verifies that all automation completed successfully. |
| 2 | Database changes are permanently written. |
| 3 | The transaction is finalized. |
| 4 | Changes become visible to other users and transactions. |
| 5 | Salesforce starts post-commit processing. |
Record State Before vs After Commit
| Property | Before Commit | After Commit |
|---|---|---|
| Rollback Possible | β Yes | β No |
| Changes Permanent | β No | β Yes |
| Visible to Other Transactions | Limited | β Yes |
| Main Transaction Active | β Yes | β Completed |
| Post-Commit Logic | Not Started | Begins |
Real Business Scenario
π’ Business Example
A sales representative creates a new Opportunity.
During the transaction:
- Validation Rules execute.
- Before Trigger updates field values.
- After Trigger creates related Tasks.
- Record-Triggered Flows update the Account.
If every step succeeds, Salesforce commits the transaction. From that point forward:
- The Opportunity is permanently stored.
- The related Tasks remain in the database.
- The Account updates become permanent.
- The changes are visible throughout the organization.
Commit vs Rollback
| Feature | Commit | Rollback |
|---|---|---|
| Database Changes Saved | β Yes | β No |
| Transaction Ends Successfully | β Yes | β No |
| Data Visible | β Yes | β No |
| Changes Reversed | β No | β Yes |
| Post-Commit Logic Starts | β Yes | β No |
Why Does Salesforce Commit at the End?
| Reason | Benefit |
|---|---|
| Data Consistency | All changes succeed or fail together. |
| Transaction Integrity | Prevents partial updates. |
| Reliable Automation | Ensures all business logic completes before data becomes permanent. |
| Database Stability | Maintains accurate and consistent records. |
π Behind the Scenes: What Happens Internally?
Validation
β
βΌ
Triggers
β
βΌ
Flows
β
βΌ
Roll-Up Summary
β
βΌ
Everything Successful?
Yes β No
β
βΌ
Commit Transaction
β
βΌ
Changes Become Permanent
β
βΌ
Start Post-Commit Logic
Think of the transaction as a single package. Salesforce waits until every step succeeds before permanently saving the package. If any step fails before the commit, the entire package is discarded to maintain data integrity.
β
Best Practice
Design automation so that failures are detected before the Commit Transaction stage. Validate data early, handle exceptions carefully, and avoid unnecessary errors that could roll back the entire transaction.
β οΈ Common Mistake
Assuming a record is permanent as soon as it receives a Salesforce Id. The record becomes truly permanent only after the Commit Transaction stage completes successfully.
π― Interview Tip
Question: Why can Salesforce roll back an entire transaction even after an After Trigger has executed?
Answer: After Triggers execute before the Commit Transaction stage. Until Salesforce commits the transaction, every changeβincluding inserts, updates, deletes, trigger logic, and Flow actionsβremains part of the same unit of work and can be rolled back if an unhandled exception occurs.
- β Final stage of the main database transaction.
- β Makes all successful changes permanent.
- β Rollback is no longer possible after commit.
- β Changes become visible to other users and transactions.
- β Post-commit operations begin immediately afterward.
- β Ensures transaction integrity and data consistency.
β‘ Next Lesson
In the final lesson of this chapter, you'll learn about Post-Commit Logic, including asynchronous processing, email delivery, platform events, outbound integrations, and other operations that Salesforce performs after the transaction has been successfully committed.
Practice What You've Learned
Test your understanding with these practice exercises