Thursday, December 28, 2017

Salesforce Flow Exceptions Unhandled

If you are Salesforce Technical person then you can relate to the pain when a Flow throws and unhandled exception. Here is what you get when this happens

  • The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID [SOME ID]. Flow error messages: <b>An unhandled fault has occurred in this flow</b> An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help.

First headache what is the [SOME ID] - Well it is the ID of the flow which threw error, very simple. Right? But remember this ID will not work simply by just adding it in Salesforce URL, there is something else you need add. Now you only have ID you don't know name of the flow and ID isn't working in URL, is it still simple? Well here are couple of solutions to get name of the flow :

  • Use URL hack. If your flow Id threw error is 'xxxxxxxxxxxxxxx' then in your URL after salesforce.com add '/designer/designer.apexp#Id= xxxxxxxxxxxxxxx'.
If instance is 'na5' then URL must look like                              https://na5.salesforce.com/designer/designer.apexp#Id=xxxxxxxxxxxxxxx
           
Don't worry if you are using lighting experience add this URL after force.com, it'll automatically redirect to classic URL
  • Use workbench (if you are not aware of the tool, please go learn it, its one of the greatest tool by Salesforce). Thanks to my colleague Jim who told me this easy trick . Log in to workbench with your instance.
Click 'Metadata Types & Components'
Select 'Flow' and Click 'Expand All'
Ctrl+F and find the Id of the flow and here you get Name of the flow

First challenge SOLVED!!! you got the name of the process builder.

Second challenge why are you getting this error? There are couple of reasons that I have faced error.
  • Most common scenario. In any of the condition in Process Builder you are trying to reference a relations field which is null. For example you are trying to update Contact's Phone if Account's Phone is not null. Your condition would look something like as below

Consider a scenario if there is no Account associated to Contact and you are trying to reference Account's phone number. Your process builder will throw error.
How do I solve this? Simple make Account mandatory field on Contact. Business is not ready for this change. No problem I have better solution. Add another condition before this condition and check if Account is not null, something like this. PROBLEM SOLVED!!!


  • This scenario is access issue and it is very rare. Your process builder is trying to update Owner of a record and that user's profile do not have access to Object of the record. This is could be business user's mistake that he might have selected wrong data entry. Technically it can be solved by providing at least Read-Only access to that Object in that user's profile but there might be some business reason that he doesn't have access to that object so Good Luck with business decision.