The Most Common Salesforce Limits (And How to Avoid Hitting Them)
Salesforce puts limits in place to ensure shared system performance. For admins and developers, these limits show up most clearly when things start breaking — usually at the worst possible time.
Below is a simple, quick-reference overview of the limits people run into most often, what triggers them, and how to avoid them.
1. Apex CPU Time Limit
What it is: Salesforce limits how much CPU time a transaction can use.
Limit: ~10,000 ms per transaction (varies slightly in async vs sync).
Why it happens:
Too many loops, nested loops, or inefficient logic
Processing more records in memory than necessary
Complex automation stacking (Flow + PB + Triggers + Apex)
How to avoid it:
Move heavy logic to Asynchronous processing (Queueable/Future/Batch)
Query and loop only what you need
Combine automation — avoid multiple Flows firing on the same object
2. SOQL Query Limit
Limit: 100 SOQL queries per transaction.
Most common cause: Queries inside loops.
Fix:
✅ Move SOQL queries outside loops
✅ Use collection filters (IN clause) instead of looping queries
3. DML Statement Limit
Limit: 150 DML operations per transaction.
Most common cause: Insert/Update inside loops.
Fix:
✅ Bulkify DML — collect records and process in a single insert/update
4. Row / Query Result Limit
Limit: 50,000 records returned from a single SOQL query.
Triggers: Reports, queries, data loads, bulk triggers.
Fix:
Use Batch Apex for large data operations
Use query filters to reduce dataset size
5. Email Sending Limits
Daily email limit (org-level): ~5,000 emails/day (varies by edition)
Single transaction limit: 10 external emails per Apex transaction
Fix:
Use Email Alerts + Workflow/Flow where possible
Use Marketing Cloud / Pardot / SendGrid for large sends
6. API Call Limits
Limit: Varies by edition + number of licenses (typically 50K–1M+ / 24 hr).
Triggered by: Middleware integrations, data sync jobs, automated imports.
Fix:
Monitor usage in Setup → System Overview
Consider Event-Driven architecture or Streaming API to reduce polling
7. Flow Element Execution Limit
Flows can run into internal limits if they loop or re-evaluate the same records.
Fix:
Avoid loops in flows where possible
Move repeated logic to Apex or a Subflow
Combine multiple flows triggered on the same object into one
Quick Summary
Limit Type
Common Cause
Fast Fix
Apex CPU
Too much logic in one transaction
Use async + optimize loops
SOQL Queries
Query in a loop
Move queries outside loops
DML Operations
Insert/update inside loop
Bulkify — do one DML per list
Query Rows
Query returns too many records
Use filters, use Batch
Email Limits
Sending mass emails from Salesforce
Use MC/Pardot/3rd-party
API Calls
Polling integrations
Switch to streaming, reduce sync frequency
Flow Execution
Multiple flows hitting same object
Consolidate flows
Final Takeaway
Most Salesforce limits aren’t random — they’re guardrails.
If you bulkify logic, avoid loops, use async where appropriate, and reduce duplicate automation, you’ll avoid nearly all of these.
Written w Chat GPT