Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
DictionaryTTransaction, Apex
DevelopmentAdvanced

Transaction, Apex

In Salesforce Apex, a single unit of execution that includes all DML operations, SOQL queries, callouts, and other operations between the start and end of an execution context, subject to governor limits as a group.

§ 01

Definition

In Salesforce Apex, a single unit of execution that includes all DML operations, SOQL queries, callouts, and other operations between the start and end of an execution context, subject to governor limits as a group.

§ 02

In plain English

👋 Study buddy

An Apex Transaction is a single unit of execution that includes all DML operations, SOQL queries, callouts, and other operations between the start and end of an execution context. Governor limits apply per transaction, and all DML either commits or rolls back together.

§ 03

Worked example

scenario · real-world use

When an Apex trigger at Tarryton Capital runs in response to an Opportunity insert, all the work - DML inserts, SOQL queries, callouts, related Apex classes invoked - happens in a single Apex Transaction. The 100 SOQL queries / 150 DML statements / 6 MB heap governor limits apply across the entire Transaction (not per-class or per-method). If the Transaction fails partway through, all DML rolls back atomically. Understanding Transaction boundaries is essential for Apex developers - bulkifying code across Transactions is the difference between scaling to 200 records or hitting governor errors at 50.

§ 04

Why Transaction, Apex matters

In Salesforce Apex, a Transaction is a single unit of execution that includes all DML operations, SOQL queries, callouts, and other operations between the start and end of an execution context. Governor limits are enforced per transaction, and DML operations within a transaction either all commit or all roll back (atomicity).

Understanding transaction boundaries is foundational to Apex development because governor limits are per-transaction. Triggers, batch Apex execute methods, and other entry points each create transactions. Mature Apex developers design code around transaction boundaries, ensuring each transaction stays within limits and handles failures appropriately.

§ 05

How organizations use Transaction, Apex

CodeBridge

Trains developers on transaction boundaries as foundational Apex knowledge.

Quantum Labs

Designs code around transaction limits for reliability.

TerraForm Tech

Uses transaction awareness for governor limit compliance.

§

Trust & references

Official documentation

Straight from the source - Salesforce's reference material on Transaction, Apex.

Was this entry helpful?
Help us write better definitions. Quick reactions or detailed edit suggestions.
§

🧠 Test your knowledge

Q1. What is an Apex Transaction?

Q2. What's atomic about transactions?

Q3. Where are governor limits enforced?

§

Discussion

Loading…

Loading discussion…