Category Archives: bulkification

Process Builder bulkification – Record Create

There’s some uncertainty developed over the years as to how much bulkification actually exists in Process Builder.

Here’s a V42 assessment for a couple of simple use cases.

Starting condition:
A Process Builder flow on Opportunity with two decision blocks; each one with an Action Group that creates a Case. The first Action Group includes an “Evaluate Next Criteria” to allow the records that meet the first condition to also flow into the second condition for evaluation.

There is a trigger on Case.

Use Case 1 – a batch of Opportunities – all of which meet condition-1 and none meet condition-2
RESULT: The newly-created Cases from the first Action Group are bulkified – any Apex trigger will see them all in a single trigger context

Use Case 2 — a batch of Opportunities – 20 meet condition 1 and a distinct set of 30 meet condition-2 (the second decision block)
RESULT:

  • The newly-created Cases from the first Action Group will be presented as batch of 20 records to the Case trigger
  • The newly-created Cases from the second Action Group will be presented as batch of 30 records to the Case trigger

Use Case 3 — a batch of Opportunities – 50 meet condition 1 and the same 50 records meet condition-2 (the second decision block)
RESULT:

  • The newly-created Cases from the first Action Group will be presented as batch of 50 records to the Case trigger
  • The newly-created Cases from the second Action Group will be presented as batch of 50 records to the Case trigger

Hence, your trigger on Case will execute twice. This might create a limits exposure and certainly affects CPU time. Even more importantly, if you are using simplistic static variables to control after insert trigger recursion, the second set of records may not fully execute as expected — be careful!

Note that if you are not using “Evaluate Next Criteria” as in the diagram below, the results above are the same.