We are running into CPU time limit exceeded errors in Salesforce. The org does have multiple Process Builders/Flows on the Case object. For a particular Case insert operation, I pulled an analysis from the dev console and it shows that Workflow (Process Builders/Flows/Workflow rules, etc) is using an ungodly amount of CPU (see below screenshot):

enter image description here

Is there any way to tell which Process Builders/Flows/Workflow rules are eating up the most CPU? Or should I start throwing darts at this problem by disabling pieces of Workflow 1 by 1 to narrow it down?

Edit: I looked at the performance/execution stack in Analysis perspective but it isn't telling me which pieces of Workflow are using the most CPU. See below screenshot: enter image description here

I drilled down pretty far in the Workflow tree and I'm seeing a bunch of n/a's (see below screenshot). Not sure why it's not telling me how much CPU each node is consuming. enter image description here


Open a Perspective that includes the Stack Tree, and you can open the various nodes to examine how much time is spent per flow. Click on Debug > Switch Perspective... > Analysis (Predefined). In the upper-left corner, you can expand the entire transaction and view its subcomponents. Navigate to where your Flows are (they should be under Workflow, I believe), and you can see how long each one took. It should be pretty easy to figure things out from there. If you have this much automation going on, it's probably time to see if you can move some or all of these to Before Save Flows, which have as much as 10 times better performance than Record Update Flows.

  • Hey sfdcfox, I was able to locate the Stack Trees (execution and performance). I expanded the nodes but they're only accommodating for a small portion of the CPU used (I updated my question, check out the additional screenshots to see what i mean). Strange that they are not giving me the full picture.
    – ronnie777
    Dec 10 '20 at 22:58
  • @ronnie777 You might need to adjust the debug log levels. I'd have to set up an example, I'll see if I can get something for you.
    – sfdcfox
    Dec 11 '20 at 1:43
  • @ronnie777. Maybe this Apex Log Analyzer Helps developer.salesforce.com/blogs/2020/12/… Dec 11 '20 at 3:14
  • @sfdcfox which debug log levels should I adjust? When I ran the analysis, I had every log level cranked up to the highest except for 'nba'.
    – ronnie777
    Dec 11 '20 at 22:22
  • @HR that Apex Log Analyzer tool is great. I wasn't aware of its existence. Thanks for sharing
    – ronnie777
    Dec 11 '20 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.