web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Want a trigger conditi...
Power Automate
Answered

Want a trigger condition based on words in filename

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm trying to build a trigger condition for my flow so the flow will only trigger if the condition is met. I want the condition to be if the filename contains the word 'drivers'.

 

I tried using this: 

 

@contains(triggerBody()?['Name'],'drivers')

 

Drogon_0-1657722342481.png

 

 

but got the error message: 

 

InvalidTemplate. Unable to process template language expressions for trigger 'When_a_file_is_created_or_modified_(properties_only)' at line '1' and column '17042': 'The template language function 'contains' expects its first argument 'collection' to be a dictionary (object), an array or a string. The provided value is of type 'Null'.'.

 

Thanks for any help you might have!

Categories:
  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Figured it out - I was missing {} brackets, so a simple syntax error. Once I added them in, the flow worked great!

     

    @contains(triggerBody()?['{Name}'],'drivers')

     

    So whenever my filename contains the text drivers, the flow will trigger. 

  • martintillbrook Profile Picture
    7 on at

    Ok, possibly a stupid question here but how do you create a condition that allows you to just type in "@contains(triggerBody()?['{Name}'],'drivers')"?

    If i create a condition it wants a value, operator and value - ie:

    martintillbrook_0-1676988097758.png

    Some guidance please as you are doing exactly what I've been trying to do all morning!!

    Thanks 🙂

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Not a stupid question at all, and it's one that took me a while to figure out. You want to set a trigger condition, which will prevent the flow from executing at all unless this condition is met. This is different from an in-flow condition, which requires the flow to be running before it checks a condition. You would want a trigger condition to help cut down on the number of times your flow runs. Why run it if the condition isn't met in the first place? 

     

    So to set this up, go to your trigger, then SETTINGS: 

     

    Drogon_0-1676990313910.png

     

    then down in the Trigger Conditions box, enter the formula: 

     

    Drogon_1-1676990362262.png

     

    Now my flow won't run at all unless the condition is met, saving a bunch of useless runs. 

     

    Hope that helps. 

  • martintillbrook Profile Picture
    7 on at

    Awesome, many thanks - thats worked 🙂

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 430

#2
11manish Profile Picture

11manish 341 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 282

Last 30 days Overall leaderboard