cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Terminate current flow instance?

Hi Guys, 

 

Apologies if this is an obvious question, but I'm new to flow and having come from a Nintex designer background I'm struggling to understand how to do a relatively simple thing in Flow

 

In short, I'm trying to terminate the current flow instance if the outcome of an approval is denied/rejected and continue with remainder actions if approved. 

 

I have found the "Terminate" and "Stop a flow" action but the terminate action cannot be added into a condition within a "for each" loop (where it needs to be") and the "Stop Flow" action isn't clear whether it will it just end the current flow instance??? 

 

Can anybody advise the best approach to solve this? 

 

Cheers

Simon

10 REPLIES 10
Super User III
Super User III

Can you post a screen shot of your Flow?

 

Can you explain why the terminate action needs to be inside of a loop?  Can just use an if statement between your approval actions an use a terminate action at that point.

 

Approval1.jpg

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

Scott
Anonymous
Not applicable

Hi @ScottShearer

 

Well, I dont actually need the loop at all, but I insert the Forms ""Get response details" action, Flow automatically applies the loop and I can't find a way to stop it from doing it? Therefore ideally I need a way to stop the flow inside the loop

 

Capture1.PNG

Capture2.PNG

This is a screenshot of my Flow, id like to add in another level before the existing one (shown by red tick in screenshot) which if approved the flow continues,  if denied the flow is terminated. Do you know of a way I could achieve that from inside the loop? 

Have you tried this:

  • Insert an approval where you have the red check mark
  • Have an If statement following the approval
    • If response = Approve
      • start another approval
      • Continue Flow logic
    • If response Not equal Approve
      • Do nothing and the Flow ends

So, everything after the first approval (including the second approval) would be inside of the If statement branch for Response = Approve

 

Will this work for you?

 

If this needs more explanation, please post here and I will provide screen shots of an example.

 

Scott

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

Scott
Anonymous
Not applicable

That certainly sounds like a possible solution. I did, however, forget to mention a critical step. Initially, I would like to a IF statement to check for a particular value. If the value equals TRUE then the Tier 1 approval is started, IF the value equals FALSE then the flow SKIPS  the Tier 1 approval and continues with the remainder actions in the flow. 

 

Here is a rather crude drawing of what I am trying to achieve. Quite possibly a lack of understanding on my part but i would like to understand what would happen in the section marked "SKIP" in the screenshot. Would the Flow stop? or would it continue to the remainder actions? (In Nitnex, this would skip and continue, which is possibly where I am going wrong)

 

If the flow stops my guess is that i would need to repeat the actions in each branch to get the outcome I would like? 

 

Capture3.PNG

 

If your Flow hit the "Skip" part of your logic/condition, it would then move on to the second Approval action.

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

Scott
Anonymous
Not applicable

Ah ok great, thanks for confirming. So I guess the section marked "End"  in its current state would also continue to the second approval action also?. 😞

 

If that's the case then I guess the question remains, how could I terminate the flow at the point marked "End" in the screenshot??

 

I notice the "End Flow" action is available but I don't know if that's the right solution or if that action applies only to the current instance or to all instances?

One option might be to set a variable in the section of your Flow marked "end".  You'll need to initialize the variable somewhere at the top of the Flow (not inside of the loop).

Directly abouve the second Approval action, insert an If statement and termintate the Flow if the variable is set to the appropriate value.  Otherwise, the Flow will continue.

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

Scott
Community Support
Community Support

Hi @Anonymous,

 

Could you please share a screenshot of your flow's configuration?

 

I have made a test and the issue is confirmed on my side. The "Terminate" action could not be used within a "Apply to each" action in Microsoft Flow currently. 

 

If you want to use the "Terminate" action within a "Apply to each" action, I afraid that there is no way to achieve your needs in Microsoft Flow. If you would like this feature to be added in Microsoft Flow, please submit an idea to Flow Ideas Forum:

https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

 

In addition, the "Stop a flow" action is used to disable a flow rather than terminate current flow. If a flow is in enable state, we could use the "Stop a flow" action to disable this flow.

 

I agree with @ScottShearer's thought almost, you could consider take a try to initialize a variable at top of your flow (not within the "Apply to each" action), the default value set to false. Within the section of your flow marked "End", add a "Set variable" action to update the value of above variable to true. Then directly above the "Second Approval action", add a Condition to check if the variable is true, if yes, do nothing.

 

Best regards,

Kris

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Guys, 

 

Just been doing some testing with the proposed solution (Thank you by the way :)) I have intialized the variable at the top of workflow with the TRUE value and I am attempting to set to FALSE when the Tier 1 Review is denied.

 

Here is the test outcome... (Looks like the Set variable action is skipping for some reason?)



FlowTest1.PNG

 

Here is the flow configuration

 

FlowTest2.PNG

 

Have i made a mistake or misundertood here? Any help much appreciated 🙂 

Anonymous
Not applicable

Hi Guys, 

 

Just been doing some testing with the proposed solution (Thank you by the way :)) I have intialized the variable at the top of workflow with the TRUE value and I am attempting to set to FALSE when the Tier 1 Review is denied.

 

Here is the test outcome... (Looks like the Set variable action is skipping for some reason?)



FlowTest1.PNG

 

Here is the flow configuration

 

FlowTest2.PNG

 

Have i made a mistake or misundertood here? Any help much appreciated 🙂 

 

Thanks

Simon

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (66,889)