7

When working with a visual flow, it seems that when you get an error saving a record because of a validation rule, that the only error Salesforce will give you is:

An unhandled fault has occurred in this flow

An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information.

It does send you an email containing more precise details about the error but your user won't know what's going on or what he did wrong.

Is there any way of showing the exact error in the flow to the user? So a solution that would always work and throw a nice message, even when new validation rules or maybe even validations coming from triggers are introduced.

I'm not in favor of having the same validation logic in both the validation rules and the flow itself.

2
  • Is this a headless flow or one with screens? If it is one with screens are using a fault capture screen (I'm happy to write up details on this if you aren't)?
    – Girbot
    Jan 19, 2015 at 11:43
  • it's one with screens
    – KoenVM
    Jan 19, 2015 at 12:00

1 Answer 1

16

You can assign a fault connector and screen to any lookup or DML action. This should capture a validation rule...although I'm not sure if it will on update of a child causing a validation rule on the parent.

All you need to do is create a screen with a text output that uses the merge field {!$Flow.FaultMessage}:

enter image description here

Then connect the action element to the screen - to do this your element needs to be connected to something else first, the second connection will be for the fault. If it is your last element drag to the fault screen twice then select the connection and press delete. You should be left with the fault line. Below is from a record create, but it could be a record update, lookup or delete:

enter image description here

3
  • 1
    wow, I actually didn't know this existed. But indeed, it does exist somewhere in the help / documentation: help.salesforce.com/… . It would be nicer though that it only shows the actual error message you chosen without the technical jingbang but in any case much better then just "unhandled fault".
    – KoenVM
    Jan 19, 2015 at 12:25
  • Agreed, it's not the most user friendly but better than the rather scary "unhandled fault".
    – Girbot
    Jan 19, 2015 at 12:27
  • Can you stop Salesforce to send flow error emails for faults that you handle this way? I prefer to not receive an email every time someone hits a validation rule... I suspected handling faults this way gracefully would prevent Salesforce to send fault emails, but no
    – Steven.B
    Nov 14, 2019 at 16:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .