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

This is an excellent article - documentation for triggers is poor. 

I am a beginner and I am not clear how you change the Column Value. Especially with regard on how to pull the critical ID. Could you add to text or direct me? Thanks

@gvSmartEnergy 

The column value would be what you want it to equal, for example 'Start'. 

Or not equal @not()

In addition to above article,

 

Here, I want to write that 'Modified By' is not equal to me

 

Here is what worked for me: 

 

@not(equals(triggerOutputs()?['body/Editor']?['Email'],'myemail@domain.com'))

 

My Settings 'Array' shows @triggerOutputs()?['body/value'] so my Trigger Conditions expression has to be written to match.

 

When I went to my sharepoint list settings, modified by, the url showed the column name is 'Editor'

 

My column value is 'myemail@domain.com'

 

For context, I am using this so that when a user updates an item in the list (modified by is not me), the flow runs through conditions to send applicable notifications, at the end of the flow the item is updated with the outcomes (modified by is me), I added this trigger condition so that it stops there and does not infinite loop. Works great! It also allows me to do bulk edits/clean up without triggering flows (or having to turn off my flow, do my bulk edits, create a new copy of the flow and delete the old flow). 

 

JulianaD_0-1652889796940.png

 

Superb, thank you! For the choice column, I was missing the /value bit. I had also renamed the column, which is a nasty trap. You have to go to the column in SharePoint settings, and determine the actual column name from the URL, when in the Advanced Column Settings page.

 

Column name is 'Email Status', but was 'Ready for Email' previously, so Column name for Power Automate is ReadyforEmail.

 

Trigger condition ended up working with this:
@equals(triggerOutputs()?['body/ReadyforEmail/value'],'Send Email')

Thanks but still not very clear unless I miss something.

How do I insert a Trigger in a Scheduled Flow to run only when TODAY()="Friday" or "Saturday"?

@PowerAutomate3 

If it's a scheduled flow that you want to only run on Friday and Saturday, then you wouldn't write that as an expression in trigger conditions, you would set that in the Recurrence (trigger action), 'Show advanced options'. Set it to run weekly, on Friday and Saturday. 

Recurrence

Interval: 1

Frequency: Week

On these days: Friday, Saturday

JulianaD_0-1673970252581.png

I am new to power automate and have been loving this article . I have been able to successfully implement a trigger that will start my automation when a value in a column is changed to paid.  It will prepopulate an excel template perfectly,  except for one very strange thing.

 

When I set my trigger and add a condition to only trigger automation when I column value changes to paid, it triggers the automation but always selects the row from the list that was last changed before the row I just changed. It is consistent every time. Even if I wait an hour and change the column of a different row again it always selects the information from the previous change. Any ideas why this would be happening? Why is it not selecting the row with the latest change?

@lkilgour 

I would need to see your flow to figure it out, but here are a few ideas off the top of my head: 

- Check your dynamic content for 'ID'. Have you selected it from under the correct action? Have you selected the right 'ID' field/output?

- Are you selecting your dynamic content from under the correct action? 

- Check your outputs (in a successful flow run) to help you find the discrepancy. You can add 'Compose' actions to your flow to help you view specific outputs. 

- Are you updating it from 'Paid' to another value first, so it doesn't retrigger? Or using multiple trigger conditions like paymentstatus eq 'Paid' and templatestatus eq 'Complete', and updating it to 'Complete' first, so it doesn't retrigger? 

- Do you need to add any actions to retrieve the item, for example, Excel, 'Get files (properties only)', 'Get file metadata', 'Get tables', 'List rows present in a table' (and filter the array to equal the item), then 'Update Row' and use the ID field/output from under the previous action? 

Thank you. I have this bookmarked to refer back to often. However, can you show me how to write the trigger condition where the choice column is blank? I've tried a dozen different ways to write it and can't get it to trigger.

 

Update 5 minutes later haha. I got it. My choice column allowed multiple options, so I used 0 as the thing to not equals.

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/