[SalesForce] Are Process Builder workflow rules more likely to violate CPU Time limts than a standard/old workflow rules

I think so and I'm wondering if others have seen similar issues. Our org has nightly job, very simple code, just updates Contact records if it meets simple criteria. It's been running for months every night with no issues

We recently started "playing around" with Process flows. Seems like SF is moving in that direction, so we should start getting used to them. However, recently, that nightly job is blowing up APEX CPU limits. Was never had an issue before. So in execute anonymous mode, opened up a debug, and the debug log looks like that ONE process flow is eating up about 5-7 seconds of the entire job.

The process flow is very simple too: ISCHANGED(Field1) && ISPICKVAL(FIELD2) then Update some other field. None of the records meet those criteria, so there's no updates – just the simple testing of whether to run the process is eating up the limit.

We have half a dozen validation rules and about a dozen workflow rules on the contact object already, some are MUCH more complicated than this one process flow (the only one running in our org right now).

I'm getting ready to convert the process flow over to an old workflow rule, but before doing so, wanted to see if others had other suggestions.

Here's a snippet from the debug code (edited for privacy) and you can see that each process flow test is taking up .003 seconds. Seems like not a lot, but over a group of big records, it adds up really quickly!

 17:16:06.441 (4441673953)|WF_FLOW_ACTION_BEGIN|x
17:16:06.441 (4441740750)|FLOW_CREATE_INTERVIEW_BEGIN|xxxxx|xxxx|xxxx
17:16:06.441 (4441784137)|FLOW_CREATE_INTERVIEW_END|xxxxxe-bb24|UpdateCurrentProcessorSwitchedDate
17:16:06.444 (4444543492)|WF_FLOW_ACTION_BEGIN|xxxx
17:16:06.444 (4444611074)|FLOW_CREATE_INTERVIEW_BEGIN|xxxxx|xxxxx|xxxxxx
17:16:06.444 (4444650150)|FLOW_CREATE_INTERVIEW_END|xxxxxxx-bb23|UpdateCurrentProcessorSwitchedDate
17:16:06.447 (4447420559)|WF_FLOW_ACTION_BEGIN|xxxx
17:16:06.447 (4447487820)|FLOW_CREATE_INTERVIEW_BEGIN|xxxx|xxxxxxx|xxxx
17:16:06.447 (4447526856)|FLOW_CREATE_INTERVIEW_END|xxxxxxx-bb22|UpdateCurrentProcessorSwitchedDate

Best Answer

This is likely due to Process Builder not yet bulkified (and you can upvote the Idea here: https://success.salesforce.com/ideaView?id=08730000000DhBlAAK). This would mean the process is being run in sequence for each record (and indeed, your log seems to confirm it) instead of workflow rules running in parallel batches.

Related Topic