Skip to content

Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Problems
  • Triggers
  • Application specific solutions
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Resources
Menu

Power Automate trigger condition based on SP multiple choice field value

Posted on September 15, 2021September 15, 2021 by Tom

“I have a SharePoint multiple choice field: Red, Green, Blue, and I want the Power Automate flow to trigger if Red is one of those choices.”


When you work with SharePoint columns, you can easily create a trigger condition with the ‘Filter array’ action. If it’s a simple column, e.g. single line of text, you can take the column as it is. For the more complex columns, e.g. people picker or choice, you select the specific property you want to use. It can be for example the ‘Column Value’ or ‘User Email’ from the available dynamic content. But once you enable multiple selection in those columns, the ‘Filter array’ trick won’t work.

If you try that it’ll add ‘Apply to each’ around the ‘Filter array’ and create a condition referencing the ‘Apply to each’. That’s not a trigger condition you can use. Trigger condition can use only output from the trigger, it can’t reference any action.

Get the list of values from trigger

Since it should be a trigger condition, the only way to build it is using expressions. As you can’t use any action, everything must be processed in a single step. It’s a similar situation to exporting multiple choice column values to .csv or HTML table, you’ll need the xpath(…) expression. I recommend you to check that article for better understanding of how the expression is created.

xpath(xml(json(concat('{"body":{"value":', triggerOutputs()?['body/Choice'] , '}}'))), '/body/value/Value/text()')

Note: the Choice part in …?[‘body/Choice‘] is the internal name of your multiple choice column.

The expression will extract only the selected values into an array without the additional information.

Build the trigger condition

Now, when you know how to get the values, you can use this knowledge to build the trigger condition. Going back to the ‘Filter array’ action, this expression is what you want to use on the left side. Since the result will be an array, use the ‘contains’ operator to check if the array contains a specific value. In the example below it’ll look for the value Red. Define the condition and switch to advanced mode.

The output will be the trigger condition…

@contains(xpath(xml(json(concat('{"body":{"value":', triggerOutputs()?['body/Choice'], '}}'))), '/body/value/Value/text()'), 'Red')

…which you can just copy/paste as a Trigger Condition to the trigger settings.

Such flow will trigger only if the multiple choice column ‘Choice’ contains value ‘Red’.

Summary

If your Power Automate flow should trigger only when users select a specific choice in a multiple choice field, you’ll need to dive into expressions. Since it’s a trigger condition, you can access only data from the trigger, and if the data is complex, so will be also the expression.

The solution above described multiple choice column, but the same approach can be used also for multiple people picker column. Extract all the relevant values in a single, yet complex expression, and check if it contains the required value. The flow won’t start unless it’s there.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

2 thoughts on “Power Automate trigger condition based on SP multiple choice field value”

  1. Bart says:
    June 10, 2022 at 3:36 am

    Hi Tom thanks for sharing.

    You know of any way to create a trigger condition to prevent flow run when another field gets updated and choice=Red already?

    btw this slightly simpler condition also seem to work nicely.
    @contains(join(triggerOutputs()?[‘body/Choice’],’|’),’Red’)

    Thanks.

    Reply
    1. Tom says:
      June 19, 2022 at 9:33 am

      Hello Bart,
      you could revert the condition by adding not at the beginning – run the flow only if the field doesn’t contain Red.
      @not(contains(join(triggerOutputs()?[‘body/Choice’],’|’),’Red’))

      Reply

Leave a Reply Cancel reply

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

Now available:

The Ultimate Power Automate expressions cheat sheet
Equip yourself with the tool to translate your thoughts into Power Automate expressions!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Hello and welcome!

My name is Tom and I'm a business process automation consultant and Microsoft MVP living in the Czech Republic. I’ve been working with Microsoft technologies for almost 10 years, currently using mainly Power Automate, SharePoint, Teams, and the other M365 tools.

I believe that everyone can automate part of their work with the Power Automate platform. You can achieve a lot by "clicking" the flows in the designer, but you can achieve much more if you add a bit of coding knowledge. And that's what this blog is about.

To make the step from no-code Power Automate flows to low-code flows: using basic coding knowledge to build more complex yet more efficient flows to automate more of your daily tasks.

  • Format results of date calculation in SharePoint columnJune 29, 2022
  • Why is your Power Automate flow creating duplicatesJune 26, 2022
  • How to create a unique identifier in your Power Automate flowJune 22, 2022
  • How to assign custom SharePoint permission level with Power AutomateJune 19, 2022
  • Remove permissions from a specific SharePoint user with Power AutomateJune 15, 2022

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

© 2022 Let's POWER Automate | Powered by Superbs Personal Blog theme