“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.
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.
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’))
Hi Tom,
I have a requirement, I want to trigger flow based on Sharepoint columncalled ‘Status’ which is a choice field contains values Pursuing, won & declined. I want to run the flow based on anyone of these values. I have written a trigger condition like this –
@or(equals(triggerBody()?[‘PursuitStatus’]?[‘Value’],’1. Pursuing’),equals(triggerBody()?[‘PursuitStatus’]?[‘Value’],’2. Won’),equals(triggerBody()?[‘PursuitStatus’]?[‘Value’],’3. Declined’))
but my flow is running into infinite loop & the flow is running when ever any column is updated instead of just status column
Hello Keshava,
it’s because you’re checking two things – item updated + column has a specific value, you’re not checking whether a specific column was updated. To run flow on a column change take a look on this article: https://tomriha.com/how-to-trigger-power-automate-flow-on-specific-sharepoint-column-update/
Hi Tom, I want to trigger a flow if a people picker column (multivalue) is not equal to another multivalue people picker column in sharepoint. I tried your expressions but they didn’t work. I also checked your reference regarding people picker, but I didn’t get it worked. I tried to first build the xpath condition in a separate flow. My trigger is on new and modified file properties. In my compose action I entered this xpath condition: xpath(xml(json(concat(‘{“body”:{“value”:’, item()?[‘Responsible’] , ‘}}’))), ‘/body/value/Email/text()’); Responsible is my people picker column. I’ve got the message, “Invalid Template”. Unable to process template language expressions in action Compose … Json Parameter is invalid. The provied {“body”:{“value”:}} cannot be parsed