Microsoft Power Automate provides rich and powerful tools, connectors, and logic to automate many common business processes within Dynamics 365 and the Dataverse as a whole. With flow functionality slowly replacing legacy Dynamics 365 workflows, Power Platform administrators and customizers now more than ever have the ability to build automations up and across to other products and solutions using various data connectors.
When Power Automate flows run into trouble, they tend to fail and remain in a failed state until a user observes the failure, attempts to resolve the error, and resubmits the flow run. This of course presents several challenges when it comes to error handling, one of which being the additional manual intervention needed to notice that a flow run has failed in the first place. There are, however, a few different methods that can be leveraged to prevent or mitigate flow failures, including a method to alert someone if a flow run is experiencing trouble.
What is Microsoft Power Automate?
Microsoft Power Automate allows organizations to develop low- or no-code ways of automating business tasks. With GUI drag-and-drop methods, flow builders can create simple to complex automation logic that interacts with not only the Dataverse, but also with hundreds of non-Microsoft products and solutions utilizing connectors.
Microsoft Power Automate is part of the Microsoft Power Platform, a suite of business tools and services that provides low- or no-code methods of working with data, including data analytics and transformation, database tools, automation, and artificial intelligence.
Microsoft Power Automate configure run after
For each action after the trigger, we can adjust that action's configurations a bit further than what is initially presented. By clicking on the horizontal ellipsis in the upper right-hand corner of an action, we can configure it even more. We can add a comment or note, adjust the action's settings, rename the action, peek the code behind the action, or configure the action's run after settings.
When we configure the run after settings, we are essentially telling the action if it should run or not depending on what occurred with the action before it. In the example above, we are telling the Initialize OpportunityId action to run if the action immediately before it (Initialize Time Zone) is successful. Otherwise, this action, and subsequently the rest of the flow, will not run and most likely fail.
This setting can be adjusted if we don't want the subsequent steps or the flow itself to fail if a particular action is not successful.
Microsoft Power Automate flow failure alert
Currently, there is no built-in way for Power Automate to notify a contact within the Dataverse via email if a flow run fails or not. This can be accomplished manually, however, by adding a send email action as the very last step in a flow and configuring its run after settings to run only if the preceding step has failed, is skipped, or has timed out.
Next, you will need to create a variable and set it to the following expression:
concat( 'https://emea.flow.microsoft.com/manage/environments/', workflow()['tags']['environmentName'], '/flows/', workflow()['name'], '/runs/', workflow()['run']['name'] )
You can then insert the value output of the variable you created above into your email body to generate a URL to the specific flow run that failed.
We love to implement the Power Platform and Microsoft Dynamics 365 here at Beringer. We’ve been working with Microsoft Dynamics since its inception, and we’re always finding innovative ways to implement the latest tools and help automate business processes.
Beringer Technology Group, a leading Microsoft Gold Certified Partner specializing in Microsoft Dynamics 365 and CRM for Distribution also provides expert Managed IT Services, Backup and Disaster Recovery, Cloud Based Computing, Email Security Implementation and Training, Unified Communication Solutions, and Cybersecurity Risk Assessment.