Fault / Error Handling in Subflows

Adam White
2 min readAug 18, 2020

With Flow taking center stage in declarative automation in Salesforce, it has become increasingly imperative to create modular and reusable Flows wherever possible. How do you do this? Subflows.

Unfortunately Subflows are not supported with the new Flow Triggers (Before-Save, After Save, and coming soon Before Delete) — which is why I don’t recommend wide-scale adoption of Flow Triggers until they do. But for Autolaunched and Screen flows, Subflows are a fantastic way to keep your flows organized, clean, and reusable.

Subflow Fault Handling through a Text Variable!

One challenge with subflows is that each subflow could have its own error handling, and you can’t specify custom fault paths from the subflow element in your parent flow.

So what do you do?

I decided to tackle this in the child flow by assigning the FaultMessage to a text variable in the child flow — and then in the parent flow you check for the presence of a non-empty FaultMessage directly after the Subflow, like below. After you assign the FaultMessage to a text variable you can continue on with whatever you want to do with the fault — send an email, show a screen, etc.

Subflow:

Parent Flow:

This of course lets you set up your own error path in the parent flow without going too crazy in your child flow with error handling. Let the parent flow figure out what to do with it!

--

--

Adam White

I’m a Solution Architect at Salesforce based in Richmond, Virginia and a contributor to UnofficialSF.com. Any opinions expressed are my own and not Salesforce’s