Post Commit Logic
Learning Content
Last updated: July 21, 2026
Post-Commit Logic
Post-Commit Logic refers to operations that Salesforce starts after the transaction has been successfully committed. Since the database changes are already permanent, these operations execute outside the main transaction and do not participate in rollback.
Post-commit processing improves application performance by moving non-critical work outside the primary transaction. This allows Salesforce to complete the user's save request first and then perform additional processing such as sending emails, publishing events, or executing asynchronous jobs.
💡 LearnFrenzy Insight
Imagine ordering food through a delivery app.
After your payment is confirmed, the order is officially placed. Only then does the restaurant receive the order, the delivery partner is notified, and tracking begins.
These follow-up activities happen after your order is finalized.
Salesforce follows the same pattern: once the transaction is committed, it begins post-commit processing.
Where Does Post-Commit Logic Execute?
Validation
│
▼
Triggers
│
▼
Flows
│
▼
Roll-Up Summary
│
▼
Commit Transaction
│
▼
⭐ Post-Commit Logic
│
├── Email Delivery
├── Async Apex
├── Platform Events
├── Outbound Notifications
└── Other Background Processing
Unlike earlier execution stages, Post-Commit Logic occurs after Salesforce has permanently saved the transaction. If a post-commit operation fails, Salesforce does not roll back the committed database changes.
Common Post-Commit Operations
| Operation | Description |
|---|---|
| Email Delivery | Send queued email alerts and notifications. |
| Queueable Apex | Execute asynchronous business logic. |
| Future Methods | Run asynchronous Apex in the background. |
| Batch Apex Scheduling | Start scheduled or background processing. |
| Platform Event Delivery | Notify subscribers after the transaction commits. |
| Outbound Integrations | Notify external systems of completed business events. |
Why Does Salesforce Use Post-Commit Processing?
| Reason | Benefit |
|---|---|
| Better Performance | Users receive faster save responses. |
| Reduced Transaction Time | Moves non-essential work outside the main transaction. |
| Improved Scalability | Supports large enterprise workloads. |
| Reliable Data | Background processes work with committed records. |
Real Business Scenario
🏢 Business Example
A customer submits a new Opportunity.
After Salesforce commits the transaction:
- A Queueable Apex job synchronizes data with an ERP system.
- A Platform Event notifies downstream applications.
- A confirmation email is delivered.
- A scheduled analytics process updates reporting systems.
Even if one of these background processes encounters an error, the Opportunity remains permanently stored because the commit has already completed.
Before Commit vs Post-Commit
| Feature | Before Commit | Post-Commit |
|---|---|---|
| Rollback Possible | ✔ Yes | ❌ No |
| Database Transaction Active | ✔ Yes | ❌ No |
| Changes Permanent | ❌ No | ✔ Yes |
| User Waiting | Usually Yes | Typically No |
| Background Processing | Limited | Primary Focus |
Typical Post-Commit Technologies
| Technology | Typical Use Case |
|---|---|
| Queueable Apex | Complex asynchronous business processing. |
| Future Method | Background callouts and lightweight processing. |
| Platform Events | Event-driven integrations. |
| Email Delivery | Customer and internal notifications. |
| Scheduled Jobs | Deferred business operations. |
🔍 Behind the Scenes: What Happens Internally?
Main Transaction Ends
│
▼
Commit Transaction
│
▼
Database Changes Permanent
│
▼
Post-Commit Queue Starts
│
├── Send Emails
├── Deliver Platform Events
├── Execute Async Apex
├── Notify External Systems
└── Background Processing
The key idea is that Post-Commit Logic runs after the transaction has ended. Because the database changes are already permanent, these background operations cannot cause Salesforce to roll back the original transaction.
Why Post-Commit Logic Matters
| Benefit | Explanation |
|---|---|
| Improved User Experience | Users are not blocked while background work completes. |
| Enterprise Integration | Supports communication with external systems. |
| Scalable Processing | Handles long-running or resource-intensive operations. |
| Reliable Transactions | Keeps critical database operations separate from background tasks. |
✅ Best Practice
Move long-running operations, large integrations, and non-immediate processing into asynchronous or post-commit mechanisms whenever possible. This keeps transactions fast, improves scalability, and provides a better user experience.
⚠️ Common Mistake
Assuming that a failure in a Queueable Apex job or email delivery will undo the original record save. Once the transaction has been committed, the database changes remain permanent even if later background operations fail.
🎯 Interview Tip
Question: Why can't a Queueable Apex job roll back a record that has already been committed?
Answer: Queueable Apex executes after the main transaction has successfully committed. At that point, the original database changes are permanent. Any failure in the Queueable job affects only that asynchronous execution and does not reverse the committed transaction.
- ✔ Executes after Commit Transaction.
- ✔ Runs outside the main database transaction.
- ✔ Cannot roll back committed records.
- ✔ Supports asynchronous processing and integrations.
- ✔ Includes email delivery, Queueable Apex, Future methods, and Platform Events.
- ✔ Improves performance and scalability by moving non-critical work out of the transaction.
🎉 Chapter Summary
Congratulations! You have completed the Apex Execution Flow chapter.
You now understand the complete Salesforce transaction lifecycle—from the moment a user clicks Save, through validation, flows, triggers, duplicate detection, database save, workflow automation, roll-up summary recalculation, transaction commit, and finally post-commit processing.
This knowledge forms the foundation for building scalable Apex applications, designing reliable automation, debugging complex transaction issues, and succeeding in Salesforce developer interviews and certifications.
Practice What You've Learned
Test your understanding with these practice exercises