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

Flow to trigger successor if all predecessors completion is equal to 1

hi all,

 

i'm trying to create a flow on a sharepoint task list (reflected from Ms Project File) to check outputs of a get items function, then send mail only if all predessors are completed, simple logic as below:

  • get items: returns a list of tasks.
    • apply to each: from the outputs of get items.
      • get predecessors of each task.
        • apply to each.
          • condition: if completion equal to 1.
          • if yes check next predecessor completion if equal to 1, if no do nothing
          • ...and so on for each predecessor.
          • if Yes (i.e. all predecessors are done) go to below next step, if no (i.e. at least one predessor is not done) do nothing.
  • send a mail to the task assigned to mail.
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Ahmad_Hlawa,

 

For the flow effect you want to achieve, I suggest you take @LeeHarris measure of marking with variables. Here's a workaround for your test:

 

Step1: Initialize a variable to count the number of not complete tasks, I set the default value is 0.

Step2: Since I don't know what predecessors you used, so I use Get items instead, and add Apply tp each to judge every completion of the task.

-If the value is equal to 0, increase variable;

-If not, do nothing.Annotation 2019-06-17 094210.png

 

 

Step3: Judge the variables whether equal to 0, if yes, send the email.

Annotation 2019-06-17 094254.png

For the issue of your reply, is it possible at the part of the red line marked? Is the value of the current item array? If yes, you can change the condition function (item('Apply_to_each')?['PercentComplete]) into (item()?['PercentComplete'])

Annotation 2019-06-17 095412.png

 

Best Regards,

Community Support Team _ Lin Tu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
LeeHarris
Solution Sage
Solution Sage

Hi @Ahmad_Hlawa 

You may be able to make use of the Terminate action within your apply to each loop. If the predecessor completion is not equal to 1 then simply Terminate the Flow to prevent any further actions being executed.

Alternatively, if you need to continue but just not send the notification. Initialize a boolean variable (called ProcessContinue) at the start of your Flow with a value of True and then set it to False in your apply to each loop if any of the Predecessors dont meet the condition criteria. Before you send your notification, check the "ProcessContinue" variable and if its False then don't send the alert.

 


Did I answer your question? Mark my post as a solution!

Follow me on Twitter at @QG_LeeJHarris

Or on LinkedIn at in/leejharris

Ahmad_Hlawa
Regular Visitor

hanks for the quick reply.

 

let me go in more details to the issue.

i'll give a try to the proposed about the apply to each.

 

 

 

but the other issue, is that the flow don't understand the below function to get the predessor completion date?( function in the 2nd condition is (item('Apply_to_each')?['PercentComplete])

Flow.jpg

Hi @Ahmad_Hlawa,

 

For the flow effect you want to achieve, I suggest you take @LeeHarris measure of marking with variables. Here's a workaround for your test:

 

Step1: Initialize a variable to count the number of not complete tasks, I set the default value is 0.

Step2: Since I don't know what predecessors you used, so I use Get items instead, and add Apply tp each to judge every completion of the task.

-If the value is equal to 0, increase variable;

-If not, do nothing.Annotation 2019-06-17 094210.png

 

 

Step3: Judge the variables whether equal to 0, if yes, send the email.

Annotation 2019-06-17 094254.png

For the issue of your reply, is it possible at the part of the red line marked? Is the value of the current item array? If yes, you can change the condition function (item('Apply_to_each')?['PercentComplete]) into (item()?['PercentComplete'])

Annotation 2019-06-17 095412.png

 

Best Regards,

Community Support Team _ Lin Tu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

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

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (5,112)