Skip to main content

Notifications

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.

pastedimage1681715402595v1.png

4, The Trigger Conditions under Settings is Null, nothing was configured.

pastedimage1681715584896v4.png

pastedimage1681715955584v2.png

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.

pastedimage1681715063046v1.png

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.

0310.pastedimage1681712926012v4.png

2, Generate the Odata expression through the Dataverse Rest Builder tool in the XrmToolBox.

pastedimage1681715468637v2.png

pastedimage1681715495066v3.png

3, Copy and Paste the expression.

pastedimage1681714883622v1.png

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:

  1. Update the field Status Reason to In Progress.
  2. Click Save

3817.pastedimage1681713055308v8.png

Expected Result:

              Doesn’t trigger the Power Automate flow.

6087.pastedimage1681713097065v10.png

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:

  1. Update the field Status Reason to On Hold.
  2. Click Save

 1602.pastedimage1681713124311v11.png

Expected Result:

              The Power Automate flow was triggered.

4426.pastedimage1681713147105v12.png

Solution 2: Update the Trigger Conditions in the Settings tab

1, Click 3 dots then select Settings.

pastedimage1681715584896v4.png

2, Config the conditions

0042.pastedimage1681713208677v14.png

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.

Comments

*This post is locked for comments