Error handing in MS Flows | CloudFronts

Error handing in MS Flows

Introduction:

In this blog we will be going through the steps of Error Handling in Microsoft Flows.

Implementation:

Step 1: We have created a basic flow that is triggered when a HTTP POST Request has be made to the generated URL. The body will contain a JSON array with some data

The flow will then take the data passed in the POST request body and for each object in the JSON array, it create a record in Dynamics 365 Customer Engagement as shown below.

Basic Flow Structure

In the above scenario  we pass the correct data, but in case the data that is passed to the URL is not correctly formatted or the data is missing we will encounter an error and the flow will fail.

To handle such situations we will define an action that will take place when an error is encountered.

Step 2: To Log the error, we will create another action to create a log error log in Dynamics 365 Customer Engagement.  To make sure that this is created only when an error is encountered we click on the Configure Run After option as  shown

Configure Run After

There are four options shown, here we select only the “has failed” option which states that the log will be created when there is a failure.

Record has failed Create Log

Once this is done we can see the the flow shows a dotted red line for the last step, this is because the “Log Error in CRM” action will run only in one scenario i.e. when the above action has failed.

Red Dotted Line Error Logging

The benefits of using this approach in our flows is that we can log all the errors at one place and also store the error response of the previous stage by simply selecting the Dynamic Content in the “Log Error in CRM” action.


Share Story :