Power Automate trigger condition based on SP multiple choice field value
Posted On September 15, 2021
“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.
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.
…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’.
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.