Blog

Beringer Team Awarded by CRMSoftware Blog

Trigger conditions in Power Automate Flow

Power Automate provides some incredibly powerful capabilities around business process automation, especially within the context of Dynamics 365 and the Dataverse.  From automating simple tasks such as automatically generating subfolders whenever a parent folder is created to tasks requiring complex conditional logic, Power Automate flows can handle the brunt of your automated business processes and so much more.

There are times, however, when a flow runs multiple times when it shouldn’t.  A great example of this is a flow that, at some point in its steps, triggers itself.  Say you want a flow to run whenever a Task within the Dataverse is created.  If that Task does not have a Due Date, you want the flow to cancel the Task and create a new Task record with a Due Date of utcNow().  Assuming all of the logic in the flow is correct (including a condition that checks to see whether or not the Due Date field contains data), when a Task is created without a Due Date, the flow will run and succeed as expected.  But the flow will run again immediately after the first run, because a Task was created by the first run.

To prevent this from happening, we can use Power Automate’s built in Trigger Conditions feature.  This can be accessed by clicking the horizontal ellipsis on the trigger step, then clicking Settings.

We will find the Trigger Conditions at the bottom of the trigger’s settings.  Here, we can add one or more conditions that must be true in order for the flow to run.

These conditions are in the form of an expression.  While these expressions can be a bit tricky to write freehand, we can access them directly by using the Filter Array action.  In our example, we want the flow to run only when the Task’s Due Date does not contain data (i.e., Due Date is equal to null).

If we add a new Filter Array action just below the trigger and input that logic, we can access the formatted Trigger Condition expression by clicking Edit in advanced mode at the very bottom of the Filter Array action.

From here, we can copy the expression, delete the Filter Array action (as it’s no longer needed) and paste the expression into the Trigger Condition.  Now, our flow will run only when the Due Date does not contain data, instead of evaluating that action as a condition inside the flow (we can elect to leave the condition in the flow as a failsafe, however).

Contact Beringer Today!

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.