Track Your Flows’ Usage of Limited Resources
Debug logs can now track the resource consumption of each finished
flow interview. Suppose that your org frequently reaches per-transaction limits, such as those
for SOQL queries or DML statements. To check your flows’ usage toward those limits, use debug
logs to track Workflow events at the FINER
level.
Where: This change applies to Lightning Experience and Salesforce Classic in Enterprise, Performance, Unlimited, and Developer editions.
Why: Creating or updating a record can trigger multiple automations in the same transaction, including autolaunched flows, Apex triggers, and record-change processes. All of these automations consume shared resources that are limited. When a limit is reached, the transaction fails.
Now you can use debug logs to determine whether or how flows contribute to each transaction’s resource consumption. The information logged in these new events can help you focus your efforts on optimizing the right flows and flow element types.
This example shows that a flow interview issued 75 DML statements. Such a high number could
indicate that a loop in the flow contains an element that creates, updates, or deletes records.
Instead of having the loop repeatedly execute that element, move the element outside the loop so
it executes only once and acts on a
collection.
08:45:05.127 (4741320574)|FLOW_INTERVIEW_FINISHED|31428290809e63dc5961431e12c7171c0d7b8fe-4c02|MyFlow 08:45:05.127 (4741384571)|FLOW_INTERVIEW_FINISHED_LIMIT_USAGE|SOQL queries: 1 out of 100 08:45:05.127 (4741396008)|FLOW_INTERVIEW_FINISHED_LIMIT_USAGE|SOQL query rows: 75 out of 50000 08:45:05.127 (4741404708)|FLOW_INTERVIEW_FINISHED_LIMIT_USAGE|SOSL queries: 0 out of 20 08:45:05.127 (4741413424)|FLOW_INTERVIEW_FINISHED_LIMIT_USAGE|DML statements: 75 out of 150 08:45:05.127 (4741421017)|FLOW_INTERVIEW_FINISHED_LIMIT_USAGE|DML rows: 75 out of 1000008:45:05.127 (4741457291)|FLOW_INTERVIEW_FINISHED_LIMIT_USAGE|Heap size in bytes: 1043 out of 6000000 08:45:05.127 (4741465282)|FLOW_INTERVIEW_FINISHED_LIMIT_USAGE|Callouts: 0 out of 100 08:45:05.127 (4741471652)|FLOW_INTERVIEW_FINISHED_LIMIT_USAGE|Email invocations: 0 out of 10 08:45:05.127 (4741477919)|FLOW_INTERVIEW_FINISHED_LIMIT_USAGE|Future calls: 0 out of 50 08:45:05.127 (4741484005)|FLOW_INTERVIEW_FINISHED_LIMIT_USAGE|Jobs in queue: 0 out of 50