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 / How to capture any err...
Power Automate
Answered

How to capture any error message in ONblock error action

(0) ShareShare
ReportReport
Posted on by 43

hi , 

kanha123_456_0-1718187347037.png

as mentioned in the screenshot ...i set up for each loop inside on block error ...i want to set a variable inside the on block error itself that if any error comes in for each loop it get caught inside on block error itself .

i tried by system.exception variable , last error.message , systemerror.message    but none of them is working

 

kanha123_456_1-1718187518013.png

 

I have the same question (0)
  • eetuRobo Profile Picture
    4,579 Super User 2026 Season 1 on at

    Use Get last error -action

    eetuRobo_3-1718187926558.png

     

    eetuRobo_2-1718187917385.png

    This is how I have set up error handling usually:
    Error block has OnError variable that it sets True if it goes to error. If error happens flow goes to the begining of the error block. 

    eetuRobo_0-1718187775865.png

    Then at the begining is Get last error -action. And then there is If statement that checks if OnError is true. And if it is then it increases error count. If errorCount is 3 then it adds that error info to error data table

    eetuRobo_1-1718187845303.png

     

  • kanha123_456 Profile Picture
    43 on at

    kanha123_456_0-1718188210305.png

    as per screenshot , i am sending an email also in this email i want to pass that variable in body part of email so that error message would also go the email body 

  • Verified answer
    eetuRobo Profile Picture
    4,579 Super User 2026 Season 1 on at

    When you set variable like you do Template to %System_Exceptions% there needs to be that variable (System_Exceptions) initialized in your flow. Do you have that? If not then that will not work since you are trying to set a value of variable that doesn't exist.
    There is no error variable if you haven't made one. So I suggest you use the Get Last error in the beginning of the On Error block. 
    Also I think you need to change to "Continue flow run" and not "Throw error" if you don't want the flow to stop when error happens. (acutally maybe not since you use run subflow)
    Add the Get Last error into your Subflow as first action.

  • kanha123_456 Profile Picture
    43 on at

    @eetuRobo yes i did the same , thanks

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 167

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard