I’m working on a Salesforce org with several Flows, Apex triggers, and scheduled automations. As the amount of data grows, some processes are taking longer to complete and a few users are seeing delays during record updates. I’d like to understand which areas I should check first, such as Flow design, Apex execution, SOQL queries, or automation order. What tools or best practices do you recommend for finding the main performance bottleneck?
#Salesforce Developer #Automation
2 answers
Hi Matteo ,
The best approach is to measure first and optimize the actual bottleneck rather than focusing on only Flow or Apex.
I would start with Salesforce Debug Logs and reproduce the slow record update. Then check:
- CPU time – Look for high CPU consumption across the complete transaction.
- SOQL queries – Avoid SOQL queries inside loops and make sure queries are selective.
- DML operations – Bulkify inserts, updates, and deletes instead of performing DML repeatedly inside loops.
- Flows – Check for unnecessary Get Records, Update Records, and large loops. Move queries outside loops and perform collection-based updates.
- Apex triggers – Ensure triggers are bulkified and avoid repeated queries or DML.
- Automation order – Review all Flows and Apex that execute during the same transaction because multiple automations can contribute to the same CPU and governor limits.
- Scheduled automation – Review the volume of records processed and consider Batch Apex or other asynchronous processing for large workloads.