cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ahmad_Hlawa
Level: Powered On

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
Highlighted
v-lin-msft
Level 10

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

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
Super User
Super User

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

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!

Proud to be a Flownaut!


Ahmad_Hlawa
Level: Powered On

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

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

Highlighted
v-lin-msft
Level 10

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

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,639)