What Is the CPU Time Limit in Salesforce?
The CPU time limit controls how long the application server can run your Apex code, triggers, flows, and declarative logic. It keeps the platform fast for everyone. When the limit hits, the platform stops the execution. Salesforce allows 10,000 milliseconds for synchronous transactions. For asynchronous transactions, the limit jumps to 60,000 milliseconds. Going past this creates a timeout limit. You can see this error in Flows, Apex, and Integrations. The error message appears when a transaction takes too long, causing a shutdown. It affects data accuracy, timeliness, and performance across your Salesforce org.Why Does Salesforce Show “CPU Time Limit Exceeded”?
Salesforce runs on shared resources. Governor limits keep every transaction fair for all users. When logic takes too long, the platform blocks processing time. An exceeded limit usually signals performance issues. Too much automation or slow execution time triggers a timeout error. The system may rollback changes to protect data integrity. The platform uses logs to track CPU consumption. That’s why proper error handling and optimisation matter. When code isn’t efficient, system resources struggle to keep up.Common Causes of CPU Time Limit Errors
| Issue / Cause | How It Impacts Performance |
| Too many loops | Increases CPU consumption and slows execution |
| Nested logic | Multiplies processing tasks |
| SOQL/DML inside loops | Repeats queries and consumes resources |
| Not using Maps/Sets | Inefficient data handling |
| Multiple automations firing | Higher workflow overhead |
| Trigger recursion | Repeated and unnecessary executions |
| Large data volumes | Overloads server resources |
| Synchronous callouts | Delays transaction processing |
| Document generation | Adds heavy processing |
| Complex formulas & roll-ups | Slows down data updates and evaluation |
How to Identify What’s Causing the CPU Spike
Start by checking Debug Logs to see where CPU usage suddenly increases. They pinpoint slow elements in flows, Apex code, and triggers. Use Flow Element-level Debug to track each step’s execution time. This helps you find the exact action causing delays or extra processing. Developers can leverage the Apex Profiler and Governor Limits monitoring to analyse processing time during a transaction. You’ll see which operations overload server resources.Step-by-Step Fixes for CPU Time Limit Errors in Salesforce Flows
Replace loops with Get Records + collections
Reduce CPU time by handling records in bulk. Too many loops slow execution and hit the timeout limit.Reduce decision logic complexity
Check Debug Logs for heavy logic. Simplify decisions and remove conditions that increase CPU usage.Avoid unnecessary field updates
Limit SOQL and DML operations. Use maps and collections to handle data efficiently.Move automation to asynchronous paths
Heavy processing should run in asynchronous transactions. It improves performance and lowers CPU consumption.Remove Process Builder or merge into Flow
Old workflow rules and PB create performance bottlenecks. Consolidate automation for better execution efficiency.Limit record-triggered flow firing
Reduce how many times a transaction starts. Too many triggers increase system resource usage.Clean unused actions and subflows
Remove old automation. Test changes in sandbox and track performance after deployment.Quick Optimisation Checklist for Admins & Developers
Admins and developers must quickly identify what slows down performance. Too many loops, repeated SOQL or DML calls, and recursive triggers increase CPU time fast. The smart fix is to make logic, move queries outside loops, and add recursion controls. Complex Flow decisions and too much Process Builder automation can also trigger issues. Simplify actions and migrate to Flow where possible. Remove old workflows and reduce heavy formula fields that slow processing. Large data tasks should run through asynchronous transactions or Batch Apex. Use maps and collections instead of repeated queries. Every improvement safeguards performance and keeps automations running smoothly without hitting the CPU time limit.Tools to Prevent CPU Errors Before They Break Production
Salesforce gives you several built-in tools to stay ahead of CPU time limit issues. The Salesforce Optimiser reviews your org and highlights automation that may slow performance. It’s a smart way to spot risks before they become real problems. The Code Analyser checks Apex code for bad patterns that increase CPU consumption. Admins can also track Flow errors in real time to catch failures linked to execution time spikes. For deeper insights, the Limits Apex class helps you monitor CPU usage while code executes. With these tools in place, your Salesforce automation stays fast, healthy, and ready for scale.
When to Use Asynchronous Processing
Some tasks are too heavy for synchronous transactions and can easily hit the CPU time limit. Move workloads like bulk updates, complex calculations, and external requests to asynchronous processing. It frees the main process to run fast and keeps users happy. Queueable Apex, Future methods, and Platform Events handle long-running or delayed tasks in the background. They improve performance without affecting front-end interactions or automation. Remember, async comes with trade-offs: results aren’t instant, and sequencing becomes important. But when workloads grow, async execution keeps your org scalable and stable.Best Practises to Avoid CPU Limits in Future Builds
- Use one automation rule per object to reduce CPU consumption.
- Simplify Flows, triggers, and Process Builder logic for smoother execution.
- Follow a technical governance checklist to monitor performance.
- Simulate testing and load before deployment to catch bottlenecks early.
- Regularly review and optimise Apex code, automation, and workflow rules.
- Keep your Salesforce org lean, efficient, and responsive for all users.





