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 / Can we get the workflo...
Power Automate
Unanswered

Can we get the workflow Error message inside our flow failed

(0) ShareShare
ReportReport
Posted on by 1,809 Super User 2024 Season 1
I have 2 scopes inside our automated flow; one which have the actions needed, while the other scope runs if the first scope failed, timeout or skipped, as follow:-
 
 
 
Now for example today one action inside the first scope for renaming a folder failed, so the second scope got reached, as follow:-
 
 
 
where inside the exception scope, i am sending an email to the admin that a flow failed, but how i can parse the Error message details, so i can send it inside the exception email? is this possible?
 
 
 
Categories:
I have the same question (0)
  • Suggested answer
    CU02121645-1 Profile Picture
    2 on at

    .
  • Suggested answer
    Pacel1 Profile Picture
    79 on at
    My solution is to add after each step the setting of the error_msg variable (Paste inside it body of previous step),
    and set the step in case of failure of a given action


    You can use this Variable to body of Your message :)
  • Suggested answer
    Pstork1 Profile Picture
    68,695 Most Valuable Professional on at
    You can use the result() function with the name of the scope to get a list of all the error messages that were rolled up by actions in the flow.  You can then use a ParseJSON on that to get the error messages and details.  Since its a scope you'll have to go a couple levels deep in the JSON to get the message you want. But it is there.
     

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • johnjohnPter Profile Picture
    1,809 Super User 2024 Season 1 on at
     
    Thanks for the reply, now i added some test actions inside a test scope, and i intentionally failed one action (which is list all libraries by entering invalid site address):-
     
    ​​​​​​​ 


    Then i got the `result('Scope')`, where i got unstructured JSON, as follow:-
     
    [
      {
        "name": "Set_variable_2",
        "inputs": {
          "name": "A2",
          "value": []
        },
        "outputs": {
          "body": {
            "name": "A2",
            "value": []
          }
        },
        "startTime": "2024-12-06T12:08:10.0848768Z",
        "endTime": "2024-12-06T12:08:10.1046236Z",
        "trackingId": "6c4fd1e4-e***3fa1aff0",
        "clientTrackingId": "08584***14474CU10",
        "clientKeywords": [
          "testFlow"
        ],
        "status": "Succeeded"
      },
      {
        "name": "Set_variable",
        "inputs": {
          "name": "A1",
          "value": []
        },
        "outputs": {
          "body": {
            "name": "A1",
            "value": []
          }
        },
        "startTime": "2024-12-06T12:08:10.1135908Z",
        "endTime": "2024-12-06T12:08:10.1341023Z",
        "trackingId": "87eb7443***9fc5775dd3",
        "clientTrackingId": "085846****814474CU10",
        "clientKeywords": [
          "testFlow"
        ],
        "status": "Succeeded"
      },
      {
        "name": "Get_all_lists_and_libraries",
        "inputs": {
          "host": {
            "apiId": "subscriptions/****sharepointonline",
            "connectionReferenceName": "shared_sharepointonline",
            "operationId": "GetAllTables"
          },
          "parameters": {
            "dataset": " https://*****.sharepoint.com/sites/Openers11111"
          }
        },
        "outputs": {
          "statusCode": 404,
          "headers": {
            "Date": "Fri, 06 Dec 2024 12:08:10 GMT",
            "Content-Length": "199",
            "Content-Type": "application/json"
          },
          "body": {
            "message": "We didn't find a site with this address. Make sure you are entering the exact address of the site.\r\nclientRequestId: 3edcf31b-073c-413a-b66b-11010cfe241f",
            "fromPolicy": true
          }
        },
        "startTime": "2024-12-06T12:08:10.1532243Z",
        "endTime": "2024-12-06T12:08:10.6108655Z",
        "trackingId": "442f4256-9327***9e742f19b371",
        "clientTrackingId": "085846811999****CU10",
        "clientKeywords": [
          "testFlow"
        ],
        "code": "NotFound",
        "status": "Failed"
      },
      {
        "name": "Compose_3",
        "inputs": " https://***.sharepoint.com/sites/Openers11111",
        "outputs": " https://****.sharepoint.com/sites/Openers11111",
        "startTime": "2024-12-06T12:08:10.1519601Z",
        "endTime": "2024-12-06T12:08:10.15239Z",
        "trackingId": "576e8385-9374-****e6abfdedf8b4",
        "clientTrackingId": "0858468119995***14474CU10",
        "clientKeywords": [
          "testFlow"
        ],
        "code": "OK",
        "status": "Succeeded"
      }
    ]
     
     
    where the "outputs" will sometimes be a string on other actions it will be Object, also the Failed action and the Succeeded actions has different format for the "outputs",,, i am interested only on the items with "status" = "Failed" >> and on the "message" inside the "body". I tired to use the Parse JSON and i tried to generate the schema from the above result, but the ParseJson action raised this error:-
     
    [
      {
        "message""Invalid type. Expected Object but got String.",
        "lineNumber"0,
        "linePosition"0,
        "path""[3].outputs",
        "value"" https://***********.sharepoint.com/sites/Openers11111",
        "schemaId""#/items/properties/outputs",
        "errorType""type",
        "childErrors": []
      }
    ]
  • Suggested answer
    Pstork1 Profile Picture
    68,695 Most Valuable Professional on at
    You will need to hand edit the schema for the Parse JSON because Inputs and Outputs can be either a string or an object.  Just hand edit it to the following.
         "inputs": {
            "type": [
              "string",
              "object"
            ],
     
    Then you can take the Parsed results and filter them to get just the "Failed" messages.  Here's a prototype I used to test your error codes.
    The final compose shows the filtered error messages.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • johnjohnPter Profile Picture
    1,809 Super User 2024 Season 1 on at
     
    Again thanks for the grate help,, but seems this approach will not allow us to capture the error message if the action which failed is inside a Condition, here what i have and the action that got failed:-
     
     
     
    But when i capture the `result('Scope')`, i got that the "Condition4" failed "An action failed. No dependent actions succeeded", but did not get the actual error message, which is that we are trying to rename a folder while one of its files are been in use:-
     
     
     
    here is the `result('Scope')` it only mention about Condition-4 and not its actions:-
     
    [
      {
        "name": "Condition",
        "inputs": {
          "expressionResult": true
        },
        "startTime": "2024-12-06T23:57:41.415188Z",
        "endTime": "2024-12-06T23:57:41.8997307Z",
        "trackingId": "3c13d375-97b7-471b-bc6a-210562b7ec35",
        "clientTrackingId": "08584680774398372982560517551CU122",
        "status": "Succeeded"
      },
      {
        "name": "Get_item-RefreshInfo",
        "inputs": {
          "host": {
            "apiId": "subscriptions/17aa0056-4c1a-4ef0-8fb5-915a677afc95/providers/Microsoft.Web/locations/westeurope/runtimes/europe-001/apis/sharepointonline",
            "connectionReferenceName": "shared_sharepointonline_1",
            "operationId": "GetItem"
          },
          "parameters": {
            "dataset": "***Sales",
            "table": "bf2bb131-dc11-4ef2-9671-0e407830aa43",
            "id": 3020
          }
        },
        "outputs": {
          "statusCode": 200,
          "headers": {
            "Cache-Control": "max-age=0, private",
            "Transfer-Encoding": "chunked",
            "Vary": "Origin,Accept-Encoding",
            "X-NetworkStatistics": "0,525568,0,0,53,0,24440,13",
            "X-SharePointHealthScore": "3",
            "X-MS-SPConnector": "1",
            "X-SP-SERVERSTATE": "ReadOnly=0",
            "DATASERVICEVERSION": "3.0",
            "SPClientServiceRequestDuration": "123",
            "SPRequestDuration": "124",
            "X-DataBoundary": "EU",
            "X-1DSCollectorUrl": "https://eu-mobile.events.data.microsoft.com/OneCollector/1.0/",
            "X-AriaCollectorURL": "https://eu-mobile.events.data.microsoft.com/Collector/3.0",
            "SPRequestGuid": "f1bd6cfe-f1bc-4ab3-b7aa-10895837b26a",
            "request-id": "f1bd6cfe-f1bc-4ab3-b7aa-10895837b26a",
            "MS-CV": "oWsJU9FwAKC6dsySblbkeA.0",
            "Alt-Svc": "h3=\":443\"",
            "Strict-Transport-Security": "max-age=31536000",
            "X-Frame-Options": "SAMEORIGIN",
            "Content-Security-Policy": "frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com teams.cloud.microsoft *.office365.com goals.cloud.microsoft *.powerapps.com app.powerbi.com *.yammer.com engage.cloud.microsoft word.cloud.microsoft excel.cloud.microsoft powerpoint.cloud.microsoft *.officeapps.live.com *.office.com *.microsoft365.com *.stream.azure-test.net *.microsoftstream.com *.dynamics.com *.microsoft.com onedrive.live.com *.onedrive.live.com securebroker.sharepointonline.com;",
            "MicrosoftSharePointTeamServices": "16.0.0.25506",
            "X-Content-Type-Options": "nosniff",
            "X-MS-InvokeApp": "1; RequireReadOnly",
            "P3P": "CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\"",
            "X-AspNet-Version": "4.0.30319",
            "X-Powered-By": "ASP.NET",
            "x-ms-environment-id": "default-afe6e33c-1b2a-41e5-a7e9-9128ddcf79bf",
            "x-ms-tenant-id": "afe6e33c-1b2a-41e5-a7e9-9128ddcf79bf",
            "x-ms-dlp-re": "-|-",
            "x-ms-dlp-gu": "-|-",
            "Timing-Allow-Origin": "*",
            "x-ms-apihub-cached-response": "true",
            "x-ms-apihub-obo": "false",
            "Date": "Fri, 06 Dec 2024 23:57:41 GMT",
            "Content-Type": "application/json; charset=utf-8",
            "Expires": "Thu, 21 Nov 2024 23:57:42 GMT",
            "Last-Modified": "Fri, 06 Dec 2024 23:57:42 GMT",
            "Content-Length": "2905"
          },
          "body": {
            "@odata.etag": "\"4\"",
            "ItemInternalId": "3020",
            "ID": 3020,
            "Tilbudsnummer1": 1009,
            "Customer": {
              "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
              "Id": 1,
              "Value": "Siemens BRA"
            },
            "Customer#Id": 1,
            "Project_x0020_name": "9001",
            "State": {
              "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
              "Id": 2,
              "Value": "Completed"
            },
            "State#Id": 2,
            "S_x00e6_lger": {
              "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
              "Claims": "i:0#.f|membership|***",
              "DisplayName": "Robotic Process Automation",
              "Email": ***",
              "Picture": "***Sales/_layouts/15/UserPhoto.aspx?Size=L&AccountName= ***"
            },
            "S_x00e6_lger#Claims": "i:0#.f|membership| ***",
            "Assigned_x0020_to": {
              "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
              "Claims": "i:0#.f|membership| ***",
              "DisplayName": "Robotic Process Automation",
              "Email": " ***",
              "Picture": "***Sales/_layouts/15/UserPhoto.aspx?Size=L&AccountName= ***"
            },
            "Assigned_x0020_to#Claims": "i:0#.f|membership| ***",
            "Status": {
              "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
              "Id": 2,
              "Value": "Won"
            },
            "Status#Id": 2,
            "Production_x0020_number": "P5019",
            "Modified": "2024-12-06T23:56:11Z",
            "Forventet_x0020_DB": "0",
            "Forventet_x0020_DG": "0",
            "Test": "2024.00000000000",
            "Test1": "12.0000000000000",
            "FolderCreated": true,
            "Created": "2024-12-06T23:51:34Z",
            "Author": {
              "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
              "Claims": "i:0#.f|membership|rp ***",
              "DisplayName": "Robotic Process Automation",
              "Email": " ***",
              "Picture": "***Sales/_layouts/15/UserPhoto.aspx?Size=L&AccountName= ***",
              "Department": null,
              "JobTitle": null
            },
            "Author#Claims": "i:0#.f|membership| ***",
            "Editor": {
              "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
              "Claims": "i:0#.f|membership| ***",
              "DisplayName": "Robotic Process Automation",
              "Email": "r ***",
              "Picture": "***Sales/_layouts/15/UserPhoto.aspx?Size=L&AccountName= ***",
              "Department": null,
              "JobTitle": null
            },
            "Editor#Claims": "i:0#.f|membership|rpa@ ***",
            "FolderID": 1273,
            "LengthName": "4.00000000000000",
            "{Identifier}": "Lists%252fTilbud%252f3020_.000",
            "{IsFolder}": false,
            "{Thumbnail}": {
              "Large": null,
              "Medium": null,
              "Small": null
            },
            "{Link}": "***Sales/_layouts/15/listform.aspx?PageType=4&ListId=bf2bb131%2Ddc11%2D4ef2%2D9671%2D0e407830aa43&ID=3020&ContentTypeID=0x010022E9A0290DA2784B9DA594421A5BDF62",
            "{Name}": "",
            "{FilenameWithExtension}": "",
            "{Path}": "Lists/Tilbud/",
            "{FullPath}": "Lists/Tilbud/3020_.000",
            "{HasAttachments}": false,
            "{VersionNumber}": "4.0"
          }
        },
        "startTime": "2024-12-06T23:57:41.9249647Z",
        "endTime": "2024-12-06T23:57:42.2289373Z",
        "trackingId": "b1245c30-0ba7-4d44-83f3-0e630434315d",
        "clientTrackingId": "08584680774398372982560517551CU122",
        "code": "OK",
        "status": "Succeeded"
      },
      {
        "name": "Condition_4",
        "inputs": {
          "expressionResult": true
        },
        "startTime": "2024-12-06T23:57:42.4903214Z",
        "endTime": "2024-12-06T23:57:44.1284377Z",
        "trackingId": "ccff9245-4ac7-4791-b4b1-da19979c4df5",
        "clientTrackingId": "08584680774398372982560517551CU122",
        "code": "ActionFailed",
        "status": "Failed",
        "error": {
          "code": "ActionFailed",
          "message": "An action failed. No dependent actions succeeded."
        }
      },
      {
        "name": "Get_items-MovedQuotationIDs",
        "inputs": {
          "host": {
            "apiId": "subscriptions/17aa0056-4c1a-4ef0-8fb5-915a677afc95/providers/Microsoft.Web/locations/westeurope/runtimes/europe-001/apis/sharepointonline",
            "connectionReferenceName": "shared_sharepointonline_1",
            "operationId": "GetItems"
          },
          "parameters": {
            "dataset": "***Sales",
            "table": "89343297-9869-4e35-816a-0e22ea99120a",
            "$filter": "Title eq '3020'"
          }
        },
        "outputs": {
          "statusCode": 200,
          "headers": {
            "Cache-Control": "max-age=0, private",
            "Transfer-Encoding": "chunked",
            "Vary": "Origin,Accept-Encoding",
            "X-NetworkStatistics": "0,525568,0,0,373,0,27378,13",
            "X-SharePointHealthScore": "1",
            "X-MS-SPConnector": "1",
            "X-SP-SERVERSTATE": "ReadOnly=0",
            "DATASERVICEVERSION": "3.0",
            "SPClientServiceRequestDuration": "53",
            "SPRequestDuration": "54",
            "X-DataBoundary": "EU",
            "X-1DSCollectorUrl": "https://eu-mobile.events.data.microsoft.com/OneCollector/1.0/",
            "X-AriaCollectorURL": "https://eu-mobile.events.data.microsoft.com/Collector/3.0",
            "SPRequestGuid": "b048ea92-6c9f-435b-b0f8-4c355f5d7541",
            "request-id": "b048ea92-6c9f-435b-b0f8-4c355f5d7541",
            "MS-CV": "oWsJU+XwAKC6dsTsiRzvPA.0",
            "Alt-Svc": "h3=\":443\"",
            "Strict-Transport-Security": "max-age=31536000",
            "X-Frame-Options": "SAMEORIGIN",
            "Content-Security-Policy": "frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com teams.cloud.microsoft *.office365.com goals.cloud.microsoft *.powerapps.com app.powerbi.com *.yammer.com engage.cloud.microsoft word.cloud.microsoft excel.cloud.microsoft powerpoint.cloud.microsoft *.officeapps.live.com *.office.com *.microsoft365.com *.stream.azure-test.net *.microsoftstream.com *.dynamics.com *.microsoft.com onedrive.live.com *.onedrive.live.com securebroker.sharepointonline.com;",
            "MicrosoftSharePointTeamServices": "16.0.0.25506",
            "X-Content-Type-Options": "nosniff",
            "X-MS-InvokeApp": "1; RequireReadOnly",
            "P3P": "CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\"",
            "X-AspNet-Version": "4.0.30319",
            "X-Powered-By": "ASP.NET",
            "x-ms-environment-id": "default-afe6e33c-1b2a-41e5-a7e9-9128ddcf79bf",
            "x-ms-tenant-id": "afe6e33c-1b2a-41e5-a7e9-9128ddcf79bf",
            "x-ms-dlp-re": "-|-",
            "x-ms-dlp-gu": "-|-",
            "Timing-Allow-Origin": "*",
            "x-ms-apihub-cached-response": "true",
            "x-ms-apihub-obo": "false",
            "Date": "Fri, 06 Dec 2024 23:57:41 GMT",
            "Content-Type": "application/json; charset=utf-8",
            "Expires": "Thu, 21 Nov 2024 23:57:42 GMT",
            "Last-Modified": "Fri, 06 Dec 2024 23:57:42 GMT",
            "Content-Length": "12"
          },
          "body": {
            "value": []
          }
        },
        "startTime": "2024-12-06T23:57:42.2512408Z",
        "endTime": "2024-12-06T23:57:42.4689707Z",
        "trackingId": "8c9cbae3-02b8-4cee-9142-fc7bca26208a",
        "clientTrackingId": "08584680774398372982560517551CU122",
        "code": "OK",
        "status": "Succeeded"
      }
    ]
  • Pstork1 Profile Picture
    68,695 Most Valuable Professional on at
    If you want to drilldown inside the condition to look for errors then put all the things on the Yes side inside a Scope action.  Then add an action if the Scope fails to get the error from the scope.
  • johnjohnPter Profile Picture
    1,809 Super User 2024 Season 1 on at
     
    Ok then this means i will need to modify all the flows and i have to encapsulate the related actions inside additional Scopes.. i were asking about doing a general modification to the workflow to get the error which is been exposed inside the UI:-
     
     
    but i am not planning to modify the buisness logic of the workflows just to be able to capture the errors,, this means modifying all the flows for all the solutions + retest everything.. not sure what else we can face then. so at this stage i will prepare a list of the common cause of the error and send them to the user and admin once the workflow fails..
     
     

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

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard