Enable Flow and Process Queries to Execute in Batches (Critical Update)

This update changes the way queries in flows and process are executed when they can be bulkified. Salesforce already bulkifies operations that create, update, or delete Salesforce records. Enabling query bulkification helps your org avoid reaching SOQL limits. If this critical update doesn’t appear in your org’s Critical Update console, your org already executes flow and process operations in batches.

Where: This change applies to Lightning Experience and Salesforce Classic in Essentials, Professional, Enterprise, Performance, Unlimited, and Developer editions.

Why: Programmers can design their code so that similar actions are performed together in one batch. For example, you can create 50 records with one operation rather than 50 separate operations. We call this concept bulkification. Even with no-code flows and processes, bulkification can prevent you from reaching governor limits because the batch is counted as only one operation. An operation is bulkifiable if it sends emails or creates, updates, deletes, or looks up records.

When multiple interviews for the same flow or process run in one transaction, each interview runs until it reaches a bulkifiable operation. Salesforce defers that operation until all interviews in the transaction reach that same operation. Then Salesforce executes that operation for all the interviews together.

Note

Note

Some objects, like UserRecordAccess and IdeaComment, don’t support bulk operations. For those objects, Salesforce executes the operations one by one.

In flows, queries are generated when executing:

  • Record Update elements
  • Record Delete elements
  • Record Lookup elements
  • Fast Lookup elements
  • Subflow elements whose referenced flows create queries
  • Apex elements whose referenced Apex code creates queries

In processes, queries are generated when executing:

  • Update Records actions
  • Flows actions whose referenced flows create queries
  • Apex actions whose referenced Apex code creates queries

Without this update enabled, Salesforce defers bulkifiable queries but doesn’t execute them in batches. Instead, it executes the queries one by one. The debug logs for your processes and flows include events that start with FLOW_BULK_ELEMENT, which indicate that Salesforce deferred the query to batch it with similar queries. Nevertheless, Salesforce executes each bulkifiable query one by one instead of in a batch.

For example, when you upload 100 cases, the Activity Management flow starts for each case, resulting in 100 interviews.

  • 50 interviews stop at Record Lookup element Look Up Events.
  • The other 50 interviews stop at Record Lookup element Look Up Tasks.
Without this update With this update
Every query is executed separately, resulting in 100 query operations. The queries are executed in two batches, resulting in two query operations.
  • One for the 50 interviews that execute Look Up Events
  • One for the 50 interviews that execute Look Up Tasks

How: To test this critical update, we recommend working in a sandbox. If you must work in your production org, do so during off-peak hours.

  1. From Setup, enter Critical in the Quick Find box, then select Critical Updates.
  2. For Enable Flow and Process Queries to Execute in Batches, click Activate.
  3. Test all your flows and processes.

If you experience any issues, contact Salesforce Customer Support.