cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PrzemekKP
Regular Visitor

folderPath Condition with variable

I'm trying to create a flow with When a file is created (properties only) trigger but I only want it work in specific folders.

In a folder structure that looks like Folder 1 -> Folder 2 -> Folder 3 -> Folder 4 I only want to tigger a flow when a file is created in Folder 2 and Folder 3. I've managed to create a flow that achieved that but I as you can see on the image below I had to indicate a specific folders in which creating a file triggers a flow.

 

Zrzut ekranu 2021-03-8 o 13.36.42.png

 

What I would like is to find a way to make a condition look like this:

 

folderPath is equal to Shared Documents/x/

or

folderPath is equal to Shared Documents/x/y/

 

where "x" is folder of any name in a Shared Documents and "y" is folder of any name in a "x" folder

 

I'd be grateful for your help 🙂

1 ACCEPTED SOLUTION

Accepted Solutions

@PrzemekKP  you can add Compose action to your flow as shown in below screenshot

 

annajhaveri_0-1615391377982.png

 

configure below expression in the compose action

length(split(triggerOutputs()?['body/{Path}'],'/'))

 

This expression will give you length of number of '/' in the folder path i.e. level of folders in folder path, so if the folder path is Shared Documents/x/ the length returned by expression will be 3 and if folder path is Shared Documents/x/y/, ,then length will be 4

 

So first add the compose action and then add condition to check if output of compose action is 3 or 4 as shown in screen shot below

 
 

Screenshot 2021-03-10 212511.png

 

 

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

View solution in original post

4 REPLIES 4
annajhaveri
Super User
Super User

@PrzemekKP  do you want to check if file is created in first level or second level of folder under Shared Documents?

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.
PrzemekKP
Regular Visitor

@annajhaveri Hi! What I want is to trigger the flow when a file is created in the second and third level under Shared Documents but not when a file is created in first, fourth, fifth and next levels.

 

Regards,

Przemek

@PrzemekKP  you can add Compose action to your flow as shown in below screenshot

 

annajhaveri_0-1615391377982.png

 

configure below expression in the compose action

length(split(triggerOutputs()?['body/{Path}'],'/'))

 

This expression will give you length of number of '/' in the folder path i.e. level of folders in folder path, so if the folder path is Shared Documents/x/ the length returned by expression will be 3 and if folder path is Shared Documents/x/y/, ,then length will be 4

 

So first add the compose action and then add condition to check if output of compose action is 3 or 4 as shown in screen shot below

 
 

Screenshot 2021-03-10 212511.png

 

 

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

View solution in original post

Hi! Thank you very much! It is exactly what I needed.

 

Regadrs,

Przemek

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (60,290)