cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PeggyLang
Helper IV
Helper IV

Apply to each

I have created 2 separate flows.
1.  When a file is created in 'Folder A'

   a)  get file properties

   b) apply to each;

          If file name contains 'Fees' AND

          If file name contains 'pdf'

   c) get '@mention'

   d) post message to '@mention' in Teams channel

 

Tested this and works great!

 

Then I created the second flow

2.  When a file is created in 'Folder A' (same folder as above)

   a) get file properties

   b) apply to each;

          If file name contains 'Billing to MK' AND

          If file name contains xls

   c) get '@ mention'

   d) post message to '@ mention' in Teams channel

 

Tested this and works great!   

 

Except seconds after Flow 2 completed successfully, Flow 1 ran again!

 

Why is Flow 1 running again?  The timing in between running Flow 1 and Flow 2 was probably 20 minutes.

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

@ScottShearer 

I did not select the 'apply each', somehow it selected itself when 'value' was used.  I have edited the flow such that the condition looks at 'x-ms-file-name-encoded' to see if it meets the conditions.
So I think I have solved for the flows running concurrently when two separate files are created at two different times.
I do like your idea of combining the two sets of conditions; although I'm not too sure how to do that.
I thought I could manage it, but a slight complication is that I have an 'initialize variable' in each of the flows. 

Flow 1 I take the month, subtract 1 and use the output in my post to a Team channel.

Flow 2 I take the month and use month in my post to the same Team channel.
I believe I need to initalize variable above the conditions?  Working on that now.

View solution in original post

@ScottShearer , @efialttes , 
I changed the Dynamic Content to look at 'x-ms-file-id' (File identifier) and now it works!!!!
One flow, 2 separate conditions!!
Thank you both for making me think and for taking your time to help out.  I sure hope I can learn enough to one day help someone here in this community because it has been MONUMENTAL in my flow education.

View solution in original post

7 REPLIES 7
efialttes
Super User
Super User

Hi!

Can you share screenshots from both current flow designs?

Some thoughts:

As a potential workaround, did you considered unifying both service logics into a single flow?

 

-What's the purpose of the 'Apply to each'? I believe if trigger is 'When a file is created in folder A there must be a way to 'get file properties' -its output is an object- and then apply a condition action block, no need to add it inside an 'Apply to each' I guess unless you perform 'Get files (properties only)' -its output is an array of objects-

Hope this helps

 

 

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



ScottShearer
Super User
Super User

@PeggyLang I believe that you are using the same trigger for both Flows and then different conditions. So, both Flows will run but only one or none of the Flows will do anything after the condition. Take a look at trigger filters if you don't want them to run unless the conditions are met.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

@ScottShearer 

I did not select the 'apply each', somehow it selected itself when 'value' was used.  I have edited the flow such that the condition looks at 'x-ms-file-name-encoded' to see if it meets the conditions.
So I think I have solved for the flows running concurrently when two separate files are created at two different times.
I do like your idea of combining the two sets of conditions; although I'm not too sure how to do that.
I thought I could manage it, but a slight complication is that I have an 'initialize variable' in each of the flows. 

Flow 1 I take the month, subtract 1 and use the output in my post to a Team channel.

Flow 2 I take the month and use month in my post to the same Team channel.
I believe I need to initalize variable above the conditions?  Working on that now.

View solution in original post

Hi!

I guess you can initialize two variables, do applying one manipulation in the first one and a different manipulation in the second one. Actually you can have two independent 'Post a message' action blocks, one using variable#1 and executed only if Condition1 is met; the other one using variable#2 and executed only if Condition#2 is met.

Please let us know your progress



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



@ScottShearer 

Oh dear.  I have completely derailed this and now nothing is working.

I have combined the two conditions.  Below is the flow.

 

PeggyLang_0-1600291653468.png

 

Below is condition 1. 

If the file created contains the word Fees in the file name - AND - is a pdf then post formulated message to Teams channel.

 

PeggyLang_1-1600291700419.png

 

Below is condition 2. 

If the file created contains the words Billing to MK - AND - is an Excel file then post formulated message to Teams channel.

 

PeggyLang_2-1600291849047.png

 

I have tried the flow with the checks beside each of the lines in each of the conditions and without the checks.

 

When I run the flow the result is 'your flow ran successfully', however, none of the conditions are satisfied. 

Message is

   'ActionBranchingConditionNotSatisfied.  The execution of template action 'Post_a_message(V3)_3' skipped:  the branching condition for this action is not satisfied.'

 

When this was working with two separate flows, the difference was that I was using 'Name' (instead of 'x-ms-file-name-encoded).  But when I use 'Name' the condition automatically changes to 'Apply to each' and then when the second file is created both flows rans.

When combining the conditions the conditions in the branching is not working.  

 

Stumped again.

@ScottShearer , @efialttes , 
I changed the Dynamic Content to look at 'x-ms-file-id' (File identifier) and now it works!!!!
One flow, 2 separate conditions!!
Thank you both for making me think and for taking your time to help out.  I sure hope I can learn enough to one day help someone here in this community because it has been MONUMENTAL in my flow education.

View solution in original post

Hi!

Did you overcome your challenge?

Congrats!

Please remember to mark the relevant answer(s) as a Solution, this way other members of the community facing similar problems can find their way faster. Note you can select more than one answer as solution, even from different members!

THanx for making this communiy great!

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (869)