Flow returns an “Unhandled Exception Error” even after finished successfully.
|Knowledge Article Number||000206065|
|Description||While creating a quote from an opportunity using Visual Flow and executing this flow, if there is a custom link on the opportunity detail page and
when the custom link is clicked, the Flow gets executed and creates a Quote. However, the following Unhandled Exception Error is thrown when the Finish Button is clicked.
FLOW_ELEMENT_ERROR|UPSERT --- UPSERT FAILED --- ERRORS : (REQUIRED_FIELD_MISSING) Required fields are missing: [Name, OpportunityId] --- for SFDC record with ID : null
|Resolution||When the Final screen of the Flow has a ‘Screen’ Element and you click on finish it usually goes back to the Start element. If the Flow starting element contains a variable which is blank (because the flow got triggered from a custom link within a record), it will throw the above error that the required fields are missing.
For example, if a Flow is using Lookup as its first element and Screen as it final element, once the finish button is clicked, the Flow returns to the Start element. As the start element is a Lookup that directly connects to a Record Create, it tries to create a new record again, but since the variables are blank, it throws the error above that the required fields are missing.
This error can be addressed by either removing the final Screen element from the Flow, or by updating the Screen Navigation Options and setting it to “Don't show Finish button”.