How to reduce Power Automate Flow Runs
Background
Recently we noticed that some flows are running, far exceeding the expected actual data.
All of these are triggered by Microsoft Dataverse D365 CRM.
As the production environment shares the same service account, and the Throughput limits apply across all runs, so, exceeding the threshold of the value of the maximum allowed run is very easy. And this is not what we want.
Analysis
After the research, we have the following findings.
1, The Trigger is Dataverse, and the change Type is Added or Modified.
2, Selected Columns is statuscode
3, The Filter rows configuration is Null.
4, The Trigger Conditions under Settings is Null, nothing was configured.
5, Based on the 3 and 4, we can conclude that whenever there is a change in statuscode, the workflow will be triggered.
6, If Item 1 or 2 in the below screenshot is not met, then do nothing and terminate the whole running. This is an invalid run. So we can move Item 1,2 to the Trigger condition and then reduce the invalid runs.
Solutions
To reduce the invalid runs, we are planning to add the Filter rows configuration or Trigger Conditions in the Settings. The following are the two manners.
Solution 1: Through the Filter rows to limit rows that can trigger the flow.
1, Add Filter rows
The description said that we need an Odata expression to limit rows.
2, Generate the Odata expression through the Dataverse Rest Builder tool in the XrmToolBox.
3, Copy and Paste the expression.
4, Run and Test
Test Scenario 1
Description:
Update the Case record and not met the trigger condition.
Pre-requisites:
Status Reason is On Hold
Origin is Email
Test Steps:
- Update the field Status Reason to In Progress.
- Click Save
Expected Result:
Doesn’t trigger the Power Automate flow.
Test Scenario 2
Description:
Update the Case record and met the trigger condition.
Pre-requisites:
Status Reason is In Progress
Origin is Email
Test Steps:
- Update the field Status Reason to On Hold.
- Click Save
Expected Result:
The Power Automate flow was triggered.
Solution 2: Update the Trigger Conditions in the Settings tab
1, Click 3 dots then select Settings.
2, Config the conditions
3, After testing, it ran as expected
Conclusion
In conclusion, by implementing these tips, you can reduce the number of runs in Power Automate and improve performance. Remember to review your flows regularly and optimize them to ensure they’re running efficiently.
The End
I hope you found this blog useful, and as always, feedback is very much welcome.
*This post is locked for comments