Microsoft Power Automate Trigger Conditions: Example-based Guide

sigmund-AIIC6wCqkQc-unsplash
Power Automate Power Platform

Microsoft Power Automate Trigger Conditions: Example-based Guide

Microsoft’s Power Platform offers a suite of tools designed to facilitate automation and increase productivity, and one of its key components is Power Automate. Power Automate is designed to automate repetitive tasks and streamline workflows. It offers a robust and user-friendly way to create automated processes that can seamlessly connect to a variety of applications and services. In this article we will discuss Power Automate trigger conditions and how to use them.

Imagine a scenario where you need to manage the number of flow runs per day in Power Platform, given the API limits. You want to ensure that your flow only runs when necessary, such as when a contact record is modified and its discount value is equal to 50. In such cases, Power Automate trigger conditions can be employed on the trigger point of the flow to achieve this level of control. By exploring power automate flow trigger conditions, you can tailor your automation processes to run only under specific circumstances, improving overall efficiency.

Trigger conditions play a crucial role in defining when a specific automated flow should start, thereby offering greater control and flexibility to users. Microsoft’s Power Automate continues to be recognized for its capabilities, as demonstrated by its recent designation as a leader in the 2022 Gartner Magic Quadrant for Robotic Process Automation

This article will provide an in-depth understanding of trigger conditions in Power Automate, including how to create and configure them effectively. We will also explore various Power Automate trigger conditions examples that will help you grasp the concept with ease.

What is a Power Automate Trigger Condition?

A Power Automate trigger condition is a custom formula or expression used to define the circumstances under which a flow should initiate. This feature is crucial for streamlining workflows, as it ensures that flows only execute when specific criteria are met.

The foundation of Power Automate lies in its connectors, triggers, and actions.

Connectors are the bridges that link different systems, services, and apps used in a workflow. They enable communication and data transfer between these elements, allowing users to create seamless automation. Power Automate provides connectors for both Microsoft and non-Microsoft apps, including Outlook, SharePoint, Dataverse, Microsoft Teams, Twitter, and many more.

Power Automate boasts an extensive selection of connectors, offering more than 900 options to choose from. To stay current with the latest apps and services, the platform consistently adds 20+ new connectors on average every month, providing users with an ever-growing range of possibilities for automation.

Different types of triggers available in Power Automate

Power Automate offers various types of triggers that cater to different automation scenarios. Some common trigger categories include:

  • Scheduled triggers: These triggers initiate a flow at predefined intervals, such as daily, weekly, or monthly.
  • Event-based triggers: These triggers activate a flow when a specific event occurs, like a new item being added to a SharePoint list or an email being received in Outlook.
  • Manual triggers: These triggers allow users to start a flow manually, either through a button or a specific action within an application.
  • Data-driven triggers: These triggers rely on changes in data, such as the modification of a record in a database or the creation of a new file in OneDrive.

You may also be interested in our detailed article What are Variables in Power Automate and How to Use Them?

How to Write Trigger Conditions in Power Automate

Writing trigger conditions in Power Automate involves using the Workflow Definition Language (WDL), an expressive language that enables users to perform various operations on data within their flows. The basic syntax for a trigger condition is as follows:

@equals(triggerBody()?[<property>], <value>)

In this example, the equals function compares the specified property of the trigger body with the provided value. If the comparison returns true, the flow will execute. You can replace the equals function with other WDL functions, depending on your specific requirements.

When using power automate trigger conditions not equal, you can specify flows to run when certain values differ, enabling more precise control over the automation process.

Now, we will walk you through the steps to write trigger conditions effectively.

Step 1: Identify the desired criteria

Before you start writing the trigger conditions, identify the specific criteria that should be met for your flow to run. Consider the event or action you want to initiate the flow and the conditions that must be fulfilled for that event or action to take place.

Step 2: Choose the appropriate trigger

Power Automate offers various triggers based on different events and services. Choose the trigger that aligns best with your automation requirements. Power Automate when an item is created or modified trigger conditions can be highly beneficial in scenarios where you need to differentiate between the creation and modification of items. For instance, when working with SharePoint lists, you might want to initiate a flow only when a new item is added or when an existing item undergoes changes.

Step 3: Learn the required functions and expressions

Familiarize yourself with the built-in functions and expressions available in Power Automate. Functions like “equals”, “and”, “or”, and others can be used in expressions to create effective trigger conditions.

To combine trigger conditions, you can use AND or OR operators:

AND: Place each condition on separate lines. The flow will only be triggered if all conditions return ‘true.’ For example, the flow will trigger only if ‘ApprovalStatus’ has the value ‘Not started’ AND ‘Approver’ is empty.

OR: If you need to use the OR operator in your trigger condition, place all conditions on a single line, connected by the OR function:

@or(condition1, condition2, condition3,...)

Remember to remove the @ symbol from the conditions, leaving it only at the beginning.

Step 4: Create the expression

Once you have a clear understanding of the functions, create an expression using them. For example, if you want to write a trigger condition that checks if a value is equal to “Not started”, you would use the following expression:

@equals(triggerOutputs()?['body/ApprovalStatus/Value'], 'Not started').

Step 5: Add the expression to the trigger settings

After creating the expression, add it to the trigger’s settings. This will ensure that your flow only runs when the specified criteria are met. Make sure to test your expression to confirm that it behaves as expected.

Read also: How to Populate a Word Document with Power Automate?

How to Set Trigger Conditions in Power Automate

Accessing the trigger configuration in Power Automate

To configure trigger conditions in Power Automate, first, sign in to the Power Automate portal (https://flow.microsoft.com/) using your Microsoft account. You can either create a new flow or modify an existing one to set up the trigger conditions as desired.

A step-by-step guide to set trigger conditions

Adding a trigger to a flow

Follow these steps to add a trigger to your flow:

  1. On the Power Automate platform, on the left sidebar select ‘My flows’ and click “+ New Flow“.
Adding trigger to flow in Power Automate: step 1
  1. Select the type of flow you want to create, such as “Automated cloud flow” or “Scheduled cloud flow”.
  2. Assign a name to your flow and click “Create
  3. In the flow editor, click “+ New step” to insert a trigger.
  4. Use the search bar to find the “When an item is created” trigger for SharePoint and select it from the list. Power Automate SharePoint trigger conditions offer seamless integration of SharePoint events and data into your flows.
  5. Use the search bar to find the “When an item is created” trigger for SharePoint and select it from the list.
  6. Power Automate trigger created in SharePoint

    Configuring the trigger condition

    Once you have added a trigger to your flow, configure the trigger condition as follows:

    1. Click on the ellipsis (three dots) in the upper right corner of the trigger card.
    2. Select “Settings” from the dropdown menu.
    3. In the “Trigger Conditions” section, click “Add” to insert a new condition.
    4. Compose the trigger condition using the appropriate syntax, comparison operators, logical operators, and dynamic content if needed. For example, to check if the price of an item is greater than 60, use the following trigger condition:
    @greater(triggerOutputs()?['body/Price],60)
    Using trigger conditions in power automate
    1. Click “Done” to save the trigger condition.

    Testing and validating the trigger condition

    After configuring the trigger condition, test and validate it to ensure your flow operates as expected. To do this:

    1. Save your flow by clicking “Save” in the upper right corner of the flow editor.
    2. Either manually trigger the flow by creating a new item in the specified SharePoint list or wait for the specified event or data change to occur, depending on the type of trigger you are using.
    trigger the flow by creating a new item
    1. Keep track of the flow’s execution by navigating to the “Flow details” page and examining the “Runs” tab.
    2. Assess the flow’s run history and confirm that the trigger condition is functioning correctly. Make any necessary adjustments to the trigger condition and retest until you achieve the desired results.
    confirm that trigger condition functions correctly

    Best practices for configuring trigger conditions

    Consider the following best practices when setting trigger conditions in Power Automate:

    • Utilize dynamic content and expressions: Take advantage of dynamic content and expressions to develop more adaptable and flexible trigger conditions that can accommodate various data and scenarios.
    • Test and validate your conditions: Consistently test and validate your trigger conditions to confirm they function as expected and produce the desired outcomes.
    • Account for performance and efficiency: Optimize your trigger conditions to minimize unnecessary flow runs and reduce the load on the Power Automate platform.
    • Document your conditions: Record your trigger conditions and their intended purpose to facilitate easier maintenance and collaboration with your team

    Best Practices for Writing Trigger Conditions

    To ensure the effectiveness and efficiency of your Power Automate flows, it is crucial to follow best practices when writing trigger conditions. Here are some recommendations:

    Keep it simple: When writing trigger conditions, aim for simplicity and clarity. Use easy-to-understand expressions and functions that accurately represent the desired criteria. This will make it easier for you and others to maintain and troubleshoot the flow.

    Be specific: Ensure that your trigger conditions are specific and clearly define the criteria required for the flow to run. Avoid using overly broad conditions, as this can lead to unexpected flow runs and consume valuable resources.

    Use comments: Adding comments to your trigger conditions can help you and others understand the purpose of the condition, making it easier to maintain and troubleshoot the flow in the future.

    Stay up-to-date with platform updates: As Power Automate evolves, new features and functions may be introduced. Stay current with platform updates to ensure you are leveraging the latest capabilities when writing trigger conditions. This will help you create more efficient and effective flows.

    Recommended reading: Power Automate Functions Overview: Definition, Cheat Sheet, Best Practices

    Power Automate Trigger Conditions Examples

    Example 1: Basic trigger condition with a single criterion

    Scenario description: You want to create a flow that sends a notification to your team whenever a new high-priority task is added to your Microsoft Planner plan.

    Trigger condition setup:

    1. Add a trigger “When a new task is created” in Microsoft Planner.
    2. Click the ellipsis (three dots) on the trigger card and select “Settings.”
    3. In the “Trigger Conditions” section, click “Add.”
    4. Write the trigger condition: @equals(triggerOutputs()?[‘body/priority’], ‘2’)
    5. Click “Done” and save your flow.

    Explanation of the trigger condition: The trigger condition checks if the priority of the newly created task is equal to ‘2’, which represents a high priority in Microsoft Planner. If the condition is met, the flow will proceed to the next action, such as sending a notification to your team.

    Example 2: Trigger condition with multiple criteria

    Scenario description: You want to create a flow that sends an email when a new item is added to a SharePoint list, but only if the item’s status is “Approved” and its value exceeds $1,000.

    Trigger condition setup:

    1. Add a trigger “When an item is created” in SharePoint.
    2. Click the ellipsis (three dots) on the trigger card and select “Settings.”
    3. In the “Trigger Conditions” section, click “Add.”
    4. Write the trigger condition:
    @and(equals(triggerOutputs()?['body/Status'], 'Approved'), greater(triggerOutputs()?['body/Value'], 1000))
    1. Click “Done” and save your flow.

    Explanation of the trigger condition: The trigger condition combines two criteria using the and logical operator. It checks if the new item’s status is “Approved” and if its value is greater than $1,000. If both conditions are met, the flow will proceed to the next action, such as sending an email.

    Example 3: Trigger condition using dynamic content and functions

    Scenario description: You want to create a flow that sends a daily summary email of new items added to your SharePoint list, but only if the total value of the items exceeds a certain threshold. For a comprehensive guide on Power Automate functions and how to use them effectively in your flows, you might want to check out this informative article Power Automate Functions.

    Trigger condition setup:

    1. Add a scheduled trigger “Recurrence” and configure it to run daily. With power automate recurrence trigger conditions, you can design flows that run at specific intervals only when the desired conditions are met.
    2. Add an action “Get items” in SharePoint to fetch new items added within the last 24 hours.
    3. Add a condition with an expression that calculates the total value of the items:
    @greater(sum(outputs('Get_items')?['body/value']), 5000)
    1. If the condition is met, add an action to send the summary email.

    The trigger condition uses the greater function along with the sum function to calculate the total value of the new items. It checks if the total value exceeds $5,000. If the condition is met, the flow proceeds to the next action, which sends the summary email.

    Read also: Sending emails with Power Automate: Step-by-Step Guide.

    Example 4: Advanced trigger condition with nested conditions

    Scenario description: You want to create a flow that sends an email when a new file is added to a specific folder in OneDrive, but only if the file is a PDF and its size is between 100KB and 1MB.

    Trigger condition setup:

    1. Add a trigger “When a file is created” in OneDrive.
    2. Click the ellipsis (three dots) on the trigger card and select “Settings.”
    3. In the “Trigger Conditions” section, click “Add.”
    4. Write the trigger condition:
     @and(contains(triggerOutputs()?['body/Name'], '.pdf'), and(greater(triggerOutputs()?['body/Size'], 102400), less(triggerOutputs()?['body/Size'], 1048576)))
    1. Click “Done” and save your flow.

    Explanation of the trigger condition: The trigger condition uses nested and logical operators to combine three criteria. It checks if the new file’s name contains the ‘.pdf’ extension, and if its size is greater than 100KB (102400 bytes) and less than 1MB (1048576 bytes). If all conditions are met, the flow will proceed to the next action, such as sending an email.

    Troubleshooting Common Trigger Condition Issues in Power Automate

    In this section, we will address common issues related to triggers in Power Automate and provide practical solutions to help you resolve them. Remember to include a Power Automate screenshot at the end of this section to support the content.

    Trigger Fails to Activate

    Sometimes, triggers fail to activate due to Data Loss Prevention (DLP) policies. These policies can prevent the flow from functioning if it violates any organizational rules. To check whether your flow is suspended due to a DLP policy, try editing and saving the flow. If there’s an issue, the Flow Checker will notify you, and your admin can modify the DLP policy.

    Disabling Admin Mode

    If your environment’s admin mode is enabled, it may cause your flow not to trigger. To disable admin mode, go to the Power Platform admin center, sign in with the appropriate credentials, select Environments, choose a sandbox or production environment, go to the Details page, and set the Administration mode slider to “Disabled.”

    Disable admin mode in power platform

    After addressing these common trigger condition issues, you should be able to resolve most problems that arise in Power Automate. As a reminder, make sure to include a relevant Power Automate screenshot at the end of this section to support the content.

    License Type Verification

    To view your license type, sign in to Power Automate, go to My Flows, select any flow, and look for the “Plan” section in the Details. This will show your current license plan.

    Examining Inputs and Trigger Conditions

    Verify that your inputs and trigger conditions are accurate by signing in to Power Automate, editing the flow, and expanding the first card to see the folders, sites, mailboxes, etc., used in the trigger. Select the ellipses (…) on the card, then choose Settings, and look for Trigger conditions.

    Conclusion

    By harnessing the power of the Workflow Definition Language and following the best practices outlined in this article, you can create customized and adaptable trigger conditions that cater to your unique business requirements. If you’re interested in learning more about Power Automate and its capabilities, Citizen Development Academy offers an in-depth course on Power Automate training, that delves into its features and how it can help streamline your business processes.

    The examples provided in this guide should serve as a starting point for developing and implementing your own trigger conditions, which can lead to increased productivity and streamlined operations within your organization. Remember to always test and validate your trigger conditions to ensure they function as intended, and don’t hesitate to explore the wealth of resources available online to further enhance your Power Automate skills.

    FAQ

    What is the trigger condition in Power Automate?

    In Power Automate, a trigger condition is a specific criterion or set of criteria that must be met for a flow to initiate. It helps control when a flow should run, optimizing the automation process and conserving valuable resources.

    How to set trigger conditions in Power Automate?

    To set trigger conditions in Power Automate, you need to create an expression using built-in functions such as "equals", "and", or "or". Add the expression to your trigger's settings, which will ensure that the flow only runs when the specified criteria are met.

    How to write trigger conditions in Power Automate?

    To create trigger conditions in Power Automate, you'll need to utilize expressions with built-in functions such as "equals", "and", "or", and more. For instance, to create a trigger condition that checks if a value is "Not started", use the expression: @equals(triggerOutputs()?['body/ApprovalStatus/Value'], 'Not started')

    How many types of flows are in Power Automate based on trigger conditions?

    Power Automate offers three main flow categories based on trigger conditions: automated, scheduled, and instant flows. Automated flows are initiated by events, scheduled flows execute at specific times or intervals, and instant flows are manually triggered by users.

    Can I use multiple trigger conditions in a single flow?

    Yes, you can include multiple trigger conditions within a single flow. When adding multiple conditions, they function as an AND operator, meaning that all conditions need to be satisfied for the flow to be triggered.

    Can I use trigger conditions with the "Recurrence" trigger?

    Yes, applying trigger conditions to the "Recurrence" trigger ensures the flow only executes when certain criteria are met, even if it is set to run at specific intervals.

    How do I handle trigger conditions with SharePoint choice columns?

    To work with SharePoint choice columns in trigger conditions, you must reference the choice column's value as follows: @equals(triggerBody()?['']?['Value'], '') Replace with the actual name of the SharePoint choice column, and with the desired choice value.

    What is a condition vs trigger?

    A trigger is an event or action that initiates a flow, while a condition is a rule or criterion determining whether a flow should proceed. Triggers start a flow, and conditions control the flow's execution based on specific criteria.

    Can conditions be used in triggers?

    Yes, conditions can be integrated into triggers to define when a flow should start. By using conditions in triggers, your flow will only run when certain criteria are met, resulting in more efficient and targeted automated processes.

    What is trigger vs action in Power Automate?

    In Power Automate, triggers and actions work together to create a complete flow. Triggers define when an automation process should start, acting as the flow's starting point. Once a trigger condition is satisfied, subsequent actions are executed in the order they are defined within the flow.

    Comment (1)

    1. Simon

      This is exactly what I needed for my project!

    Leave your thought here

    Your email address will not be published. Required fields are marked *