The Microsoft Flow provides us no-code solutions which help us to achieve the requirements faster. But, what if we want to manage the things based on the errors or breaks in the flow and if the flow is failed due to some reason? In this blog, I will explain to you how to handle errors or breaks in the MS Flow.
I had decided to write this blog when I had achieved the requirement to inform the end user that one of the steps in the MS flow has been failed.
Let’s see how I had achieved it!!
I had made use of “Scope” control to define my steps in the MS Flow within a scope.
Suppose, I have a flow which is triggered by the creation of a lead entity record in Dynamics 365 CE/CRM. Now, I have added two steps inside the “Scope Try”. One, to get the record from the related entity and another step to update a record as shown in the below image:
I want to notify the user when there is a failure in any of the step in the flow. So I have added one more scope and named it as “Scope Catch”. In this scope, I am sending email to the user, notifying that one of the steps in the flow has been failed.
In order to handle the failure in the flow, click on the “Configure run after” for the catch scope:
Select the action on which you want to send the email. In the below image, you can see that I am configuring to send the email when any of the steps in the previous scope is failed.
Also it is possible to keep track of the exact error that is thrown in the flow. For example, if I have the below-highlighted error message thrown in the flow:
Then you can make use of below expression to get the error message and can send it in the email body to the user.
In the above formula, ‘get_record’ is the name of the step in the flow of which I want to access the error message.
In this way, you can inform the user regarding the failure in the flow or can do the needful as per the requirement. For example, you can send the mail to the end user directly when the step fails or you can insert records in the custom entity to log the errors or do any other action as required.
Hope this helps you!!
ATM Inspection PowerApp to ease ATM inspection and report generation process.
Insert data into Many-to-Many relationship in Dynamics CRM very easily & quickly, using the Drag and drop listbox.
Comply your Lead, Contact, and User entities of D365 CRM with GDPR compliance using the GDPR add-on.
Create a personal / system view in Dynamics CRM with all the fields on the form/s which you select for a particular entity using the View Creator.
© All Rights Reserved. Inkey Solutions 2021