Flow Validations
Where Flows work, or come completely unstuck due to validation rules, other flows, or anything else along the line failing…
The current state (as of Summer '21) is atrocious and it has been atrocious for years.
To think that Salesforce expects that users can just get an Unhandled Exception error and no way of doing anything about it is just appalling. So I’m trying to document them as I go along and work out the best way of avoiding them if possible.
Regular Validations
Not related to Flows
Lookup Filter Validation
Validating that the lookup must be a specific record type
Works well
Validation Rule
Simple Validation on the status of a field
Works Well
Before Save Flow
Field Set that invokes Validation Rule
Works well
No Error Message
No Error Email
No Error Thrown
After Save Flow
Bad Value for Restricted Picklist
This was from a Quick Action where a Flow was setting the bad value. (Intentionally caused to debug the flow).
It is absolutely unacceptable that this type of error is displayed to a user in any situation. (I got the Debug email, and that is fine to get the error in there). The error should say only “bad value for restricted picklist field: Error.“
Let’s talk more about unacceptable…
In this case I was trying to force an error to get the flow to appear in the Failed Flow Interviews.
But this was the error I got on the record page.
What on earth am I going to do with that as a user?
Using Narender Singh’s Exception Message
This is a standard Apex Exception message
But it’s created as a handy Invocable Apex that you can force an error in Flows
https://forcepanda.wordpress.com/2019/12/26/how-to-throw-exceptions-in-flows/
but it’s still UGLY and not acceptable for end users. I use it for debugging though!
Apex Errors
And it’s not even just flows. This is an Apex trigger error. Under no circumstances should this ever be seen by the user.
There is a Duplicate rule here being hit. So why isn’t the duplicate rule error message only being displayed?
My client came back to me with this:
Hey Jodie, This record is generating an error message I've never seen before. XXX is trying to change the end date and the status to Inactive but a giant error SNAG message appears when trying to save. I'm getting the same experience.
This is what exactly the same duplicate rule looks like when editing the Contact record.
WHY can’t this or a similar error message be shown no matter HOW the error ocurred. The Apex code has the context of which record it was trying to update at that time so why can’t it just show a nice error message of “Contact Alex Jones related to this record looks like an existing record. Make sure to check any potential duplicate records before saving. View Duplicates on Alex Jones.”
This is why I generally disable ALL duplicate Alerts (I had missed this one).