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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / On Block Error to crea...
Power Automate
Answered

On Block Error to create output variable

(0) ShareShare
ReportReport
Posted on by 3

Having trouble with an error handling flow:

 

Goal:

Have a PAD flow generate a variable on error and pass it to a cloud flow. That variable in the cloud flow is then passed to an expression that outputs to a simplified message in a Slack channel. 

 

The setup:

1. I have 3 subflows within a main flow that run to turn down accounts - these all work well.

2. I have nested each subflow's actions within an On Block Error that is set to "Throw Error"

3. I have an Output Variable of BlockError created. Name is BlockError, type is text, External value is BlockError.

4. I have a Set Variable action as the last step within the On Block Error nesting. This is set to apply a text value of Service1 to the variable BlockError. Service2 and Service3 are set in the other subflows, respectively.

 

The problem:

Everything works EXCEPT there doesn't seem to be a variable coming from the PAD flow. The error hits, sends info to the cloud and sends the message to slack. However when I look at the cloud run history, it shows nothing but a blank value coming from PAD like no variable was produced or at the very least a blank string.

 

What I have tried:

1. Having Set Variable inside the On Error Block

2. Having Set Variable outside the On Error Block

3. Having Set Variable outside the On Error Block  + telling the error block to go to a label I set to run the Set variable action

4. Having Set Variable inside the On Error Block  + telling the error block to go to a label I set to run the Set variable action

5. Changing variable and value names

6. Rebuilding the flow

 

Am I doing something wrong? This is the first time I'm using On Block Error and to my understanding the set variable runs automatically as long as it's at the end of the actions, but before the end of the On Block Error. Something tells me this is not the case and that nothing but blank info is passing to my cloud flow because the variable isn't being triggered at all. 

PC: Win Server 2019
PAD ver: 2.36.228.23271

  • Verified answer
    Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    If you want a variable to be set on error, add that as a rule into the On block error action itself:

    Agnius_0-1698216338755.png

     

    Click on "New rule" and select "Set variable". You will then be able to select the name of the variable and a value for it.

     

    If you have a Set variable action outside of the block, and the block is set to throw an error, it will never really get to setting the variable.

     

    Also, make sure you enable the "Capture unexpected logic errors" toggle in the On block error action, so it captures all exceptions properly. 

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 355

#2
11manish Profile Picture

11manish 336 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard