14 May Handling Flow Faults Elegantly
- Exceptions and Errors are not handled at all resulting in a bad user experience OR
- Always capturing the Exceptions but not taking action after that may result in silently killing them and giving users an impression that everything worked as expected but actually, it did not do what was expected from that automation.
Custom Object (Fault Log)
- Name (Auto Number)
- Flow Name (Text) – To Capture the name of the flow from where the exception was raised
- Record Id (Text) – If raised by a Record Triggered Flow, this can be used to capture the record Id from which this exception was originated
- Details (Long Text Area) – To capture the Fault Exception details.
- Details – Text – Available for Input
- FlowName – Text – Available for Input
- RecordId – Text – Available for Input
Here is the sub-flow that creates a new record in Flow Log custom object:
Using Fault Handler Sub Flow
Now that we have all the Ammo ready, lets see how we can use this. In any given flows where you can capture faults.
Click on a node to add a Fault Path, usually they are the GET and DML nodes in the flow.
There are multiple options to select from while adding a Fault Path, select Sub Flow and select the Sub Flow named “Fault Handler” that we have just created and set these values
Details – Set the Flow > Fault Message in this field.
Flow Name – This is the current parent flow name from where the exception has been triggered.
Record Id – Id the record that triggered the flow.
Finally, this is how the Fault Handler looks like after adding it to a node. The details will be captured in the custom object if there is an exception.
Please Note that adding this fault handler can be an addition to how you want to handle the complete Flow Path. You can still add additional actions to the flow path along with this Fault Handler Sub Flow.
Now that we have the issues logged in the custom object, here is how you can use them:
- Create a formula field on “Flow Log” custom object to categorize the records.
- “Flow Log” records can be assigned automatically to the relevant team to work upon.
- Admins can create reports and analyze them to find a permanent solution to these issues or handle them in a better way in the flows.