cancel
Showing results for 
Search instead for 
Did you mean: 
JulianaD

How to write TRIGGER CONDITIONS for a specific text or choice value (SharePoint List, SharePoint File Properties, Excel Table, etc.)

If you have a SharePoint list, SharePoint file property, or Excel table, and you want your flow to trigger ONLY when a certain value is entered or selected (e.g. “Start”), you will want to write a Trigger Condition in your Trigger Action/Card Settings. I use this a lot, to give the end user control over when the flow starts (like to start an approval, send a notification, generate a pdf, or to re-trigger a flow that failed or timed out). Or, to trigger a flow that updates something else. Or, to trigger secondary flows at any time, past the 30 days when the first flow ran.

 

While you could use a Condition as your first action after your trigger, using a Trigger Condition is cleaner.

 

I have found that the syntax you will use to write your Trigger Condition will vary, to match what is shown in ARRAY, and whether it is a TEXT or CHOICE column/property. 

 

Here is what has worked for me: 

 

CHOICE COLUMN

 

For a choice column, the column syntax (body) needs to include "_________/value" (with the underlined blank being the column name, and /value being that it is a choice column). 

 

E.g. In this flow, I have a choice column named "TriggerFlow"

If the user wants to trigger the flow, they need to select "Start" and save, then the flow will run and immediately update it to "In Progress", then start an approval, then update it to "Approved", "Rejected", etc.

(It's important to update it from "Start" to "In Progress" first things first, so that it does not re-trigger if edited / create an infinite loop when updated by the flow.) 

In the card Settings:

Array: @triggerOutputs()?['body/value']

(Write your trigger conditions to match the Array syntax)

Trigger Conditions: @equals(triggerOutputs()?['body/TriggerFlow/value'],'Start')

(TriggerFlow/value is my choice column)

(Note, if the Array shows triggerBody instead of triggerOutputs, update your syntax to match, like in the examples below, but always keep /value if it is a choice column.)

 

TEXT COLUMN (Array shows triggerBody)

 

If Array is @triggerBody()?['value'], your syntax is: @equals(triggerBody()?['ColumnName'],'ColumnValue')

 

E.g. In this flow, my column name is "WorkflowStatus", and column description tells the user to type "Start" and save to trigger the flow. 

In the card Settings:

Array: @triggerBody()?['value'] 

(Write your trigger conditions to match the Array syntax)

Trigger Conditions: @equals(triggerBody()?['WorkflowStatus'],'Start')  

(WorkflowStatus is my text column)
(This worked for me, but only after I changed it from a choice column to a text column. This was before I figured out the above for choice columns.)

 

TEXT COLUMN (Array shows triggerOutputs)

 

If Array is @triggerOutputs()?['body/value'], your syntax is: @equals(triggerOutputs()?['body/ColumnName'],'ColumnValue')

 

E.g. In this flow, my column name is "GeneratePDF", and trigger is "Yes".

In the card Settings:

Array: @triggerOutputs()?['body/value']

(Write your trigger conditions to match the Array syntax)
Trigger Conditions: @equals(triggerOutputs()?['body/GeneratePDF'],'Yes')

(GeneratePDF is my text column)

 

NOTES

 

The column name must be one continuous string with no spaces (or characters?) at the time you create the column.

You can see the column’s forever name, in the SP list settings, when you click on the column name, it is at the end of the url. If needed, create a new column and delete the old one (after copying/pasting values over). And get in the habit of doing that when you create SP columns. E.g. name your column "WorkflowStatus", not "Workflow Status”. You can update the name after it’s created to something more user friendly. Same thing applies with Filter Query, so save yourself the potential headaches. 

 

Your first action after the trigger should be to update the item, changing the ColumnValue, so that it does not re-trigger if edited / create an infinite loop when updated by the flow. E.g. update it from "Start" to "In Progress".

 

My trigger actions/cards include "When an item is created or modified" in a SharePoint List, and, "When a file is created or modified – properties only" in a SharePoint Document Library using file properties like a list. I only want it to trigger if selected to, e.g. user selects/enters Start or Yes. This is similar to the old (now disabled) Workflow tool that allowed users to choose if/when to route/trigger for approval. (And easily allows anyone to retrigger if timed out or rejected.) The above concepts could also be applied to any values you are wanting to write expressions for, and would be more or less the same for Excel tables. (However, you will encounter failures in an Excel table if end users have access to filter the table. For that reason, a SharePoint List is better than an Excel Table, if possible.)

 

Cheers,

Juliana Donkersgoed

Citizen Developer & Business User

Comments
About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/