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 Platform Community / Forums / Power Automate / Get error message for ...
Power Automate
Unanswered

Get error message for the action 'on failure'

(0) ShareShare
ReportReport
Posted on by 66

Hi, 

I'm trying to set up error handling in one of my flows. I have 'Create file' action and then 'Exacute strored procedure' on failure. First issue i noticed is if my 'create file' failes but the stored procedure is executed, in the run history it still says Flow was succesfull. I don't think thats informative enought - something still failed and it should be visible in the run history.

failed but successfull.png

You can't just say it run successfully, when one of the steps failed...

Second issue I have is that I have the information on which step of my flows failed but I would also like to get the error message flow provides.

errormsg.png

It would make life so much easier to have the error message avaliable as a dynamic content... Does anyone had a similar problem? Any ideas on how to work around it?

 

Categories:
I have the same question (0)
  • Verified answer
    yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @olgaoszcz 

     

    The action "Create File Failure Event" you have modified the run after settings of this action to run even when the Creaet File Action fails (please click the ... on the action to see the run after settings) and therefore flow carries on the process instead of marking failed because it is being made to move to the next action forcefully when the particular action has failed (makes sense?)

     

    The get error message as dynamic content is currently unavailable as a direct action in flow. You can post that as an idea here:

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

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

  • olgaoszcz Profile Picture
    66 on at

    Hi @yashag2255,

    Thank you for your message.

    I set up the 'on failure' on purpose only after the create file fails to handle the errors. As i understand thats what it was developed for...  https://flow.microsoft.com/en-us/blog/error-handling/

    Therfore I do not understand why the flow 'is successfull' when it clearly isnt, only the erros have been handled successfully...

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    Consider putting a Terminate action after the Create File Failure Event and set the status to Failed.  That will let you specify an error code and an error message where you can pass on the error message that you have inside the Flow. That Terminate will only run if the Create File Failure Event runs because the create file failed.  The Terminate command will End the Flow at that point (its the end anyway), mark it as failed, and the errror message will be available in the Flow Run record.

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    @olgaoszcz 

     

    Yes! On the blog you can see that the error handling was configured to check and introduce a way that if a particular action is successful move and perform an action and if it is not successful (Timed out, Skipped, Failed) then do a particular action. So once you force the flow to perform actionsbased on the previous ones, the logic is built that we have intentionally added the action and we want to log it that way (example: if the action was successful go and update an item on SP and if it failed then log an error to another list or send an email to someone and then configure a retry and things like that). 

     

    As @Pstork1 mentions, you can use the terminate action to generate an error code and show the status if something has failed but you cannot use the output of that elsewhere as the flow terminates at that action. 

     

    Hope this helps!

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • olgaoszcz Profile Picture
    66 on at

    Hi @Pstork1 ,

    The Terminate action sounds like a good solution but the Create File Failure Event is not the end of the Flow, it's actually inside the 'apply to each' and I want the Flow to run through the other files even if one of them failed. Also, I want to have the error message as a dynamic content to send it together with the error alert. 

    Thanks for your help Smiley Happy

     

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    Add an action inside the loop right after the action that can fail.  Set the new action to only run if the previous action failed using 'Configure run after'. The new action should set an error message which you can return at the end of the program.  If the previous action succeeds then the error action will be skipped. Make sure to set the other actions after the error action to run if the previous action was successful or skipped.

  • olgaoszcz Profile Picture
    66 on at

    Thank you @Pstork1, as you can see from my post, that is exactly what I have done in my Flow. Although, this doesn't allow me to pass the error messages to the next action, there is no possibility to get the error message as dynamic content to pass it thought. This functionality doesnt exist and I'm planning to post that in Flow Ideas.

    Thanks for you input.

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    @olgaoszcz 

     

    As mentioned in one of the previous posts, the error message action genearted when an action fails cannot be passed further in the flow right now. It is a good idea to go ahead and create that as an idea on the community forum. 

     

    P.S. For some reason this has been happening with me, I am trying to reply to a conversation and then suddenly the accept solution button gets clicked so please excuse me for that. Just trying not to do that (happened on a couple other threads too so my apologies)

     

    Can you please mark this thread as answered to the appropraite post(S) that helped you!  Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search.

  • Verified answer
    MichelH Profile Picture
    401 on at

    Hi 

    olgaoszcz

     

     

    I have been trying to obtain the same thing, just simply getting the error message in flow, and sending it to myself.

     

    I found it can be done using the actions() function.

    In your case the argument of the action function would be 'Create_file' since that is the name of the component you want to monitor.

    It will return an object somewhat like this example of: actions('Set_variable_3')

    {
     "name": "Set_variable_3",
     "startTime": "2019-09-09T19:46:51.4123218Z",
     "endTime": "2019-09-09T19:46:51.4123218Z",
     "trackingId": "53a0681f-7810-4bbe-9494-a5cdcdeadb0b",
     "clientTrackingId": "08586335800123686594686241510CU42",
     "clientKeywords": [
     "testFlow"
     ],
     "code": "BadRequest",
     "status": "Failed",
     "error": {
     "code": "InvalidTemplate",
     "message": "Unable to process template language expressions in action 'Set_variable_3' inputs at line '1' and column '2677': 'The template language expression 'actions('conversion_to_currency').outputs.body.status' cannot be evaluated because property 'status' doesn't exist, available properties are 'name, value'. Please see https://aka.ms/logicexpressions for usage details.'."
     }
    }

    So in my case the name of the component I monitored was 'Set_variable_3' .

     

    Now in order for you to get just the error message you can say: actions('Create_file').error.message

    If you want to check first if the action failed or succeeded you can check the status: actions('Create_file').status

     

    You can use these as arguments in the SQL 'Create_Failure_Event' component to store the error message if any.

    Or you use these to fire a terminate component that matches the status

     

    Best regards,

     

    Michel

     

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    What I was suggesting is that you create a variable.  Then when the action fails set an error message in the variable as the action that runs after failure.  That would preserve the error for the rest of the Flow.

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard