web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Automate
Suggested Answer

Breaking out of Scope

(1) ShareShare
ReportReport
Posted on by 17

I was wondering if its possible to break out of a scope?

 

I have a number of steps which id like to place into a single scope [Scope 1], then if any step *fails*, id like to exit the current scope and run the next scope [Scope 2] (which which is configured to run only when the above scope fails, is skipped or timesout).

 

I thought I could do it by using Terminate-Failed, but this skips Scope 2 as well.

 

*Fail* here could either be, those determined by the flow (e.g. status code 400 from a http call) or by some user defined criteria within Scope 1 (e.g. "if value is equal to xxxx then Fail")


TIA

Adam

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @AdamWilliams,


    Maybe you can use the configure run after option settings. Over there you can configure when the second scope should run. You can for instance set that one up that it only runs when the previous scope fails.

     

    configurerunafter_failed.png

  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @AdamWilliams,

     

    Apologies, after reading your original post it looks like you are already using that configure run after setting, correct?

     

    For additional checks you can probably use a condition action and look for instance at the statuscode of the result outputs of the different actions within your scope.

     

    Below example gives back the statuscode of the first action within scope action.

     

    result('Scope')[0]['outputs']['statusCode']

     

     

     

  • AdamWilliams Profile Picture
    17 on at

    Hi @Expiscornovus 

     

    Yes its already configured and so this works in the case where a failure is determined by the flow (e.g. status code 400 from a http call)

    However (as far as I can tell) I cannot manually trigger a "Fail" for some other user defined condition e.g.

     

    AdamWilliams_0-1623950606734.png

     

    Essentially I want a "break" 🙂

     

    Thanks Adam 

     

     

     

  • AdamWilliams Profile Picture
    17 on at

    Ok, so in my reply to @Expiscornovus I figured I "could" trigger a failure generated by the flow.

    By intentionally calling a http request which would give a 404, which in turn is handled by the flow as a failure.

    As below

     

    AdamWilliams_0-1623952067692.png

    AdamWilliams_1-1623952085435.png

     

    For an input "Yes" we get

     

    AdamWilliams_2-1623952200502.png

     

    And an input "No":

    AdamWilliams_3-1623952235365.png

     

    But the very fact I "could" do this, really doesn't I "should".

    Any other "proper" suggestions 😄


    Thanks

    Adam

     

  • Cam Profile Picture
    185 on at

    i would also like this.

    i have the exact same scenario - i'm using a TRY CATCH FINALLY pattern, and i'm trying to self-generate error messages in the TRY block, which i want to be handled by the CATCH block.

     

     

    @AdamWilliams did you find a way?

  • AdamWilliams Profile Picture
    17 on at

    Hi @Cam,

     

    Unfortunately reviewing my flow, it looks like I did not find a solution to this.

    If you do happen to find something then please let me know !!

     

    EDIT: Thinking about this I had an idea, though once again it's not the best.

    You could place all processes of Scope1 that you would want to run after the Condition within the "IF yes" branch.

    Therefore if the Condition is "if no" then nothing runs in Scope 1, and then continues into Scope2

     

    Adam

  • Suggested answer
    alexmichelsen Profile Picture
    2 on at
    You can use a Compose step to break out of scope by triggering a division by zero error, e.g. div(1,0) 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard