Skip to main content
Power Automate
    • Connectors
    • Templates
    • Take a guided tour
    • Digital process automation
    • Robotic process automation
    • Business process automation
    • Process advisor
    • AI Builder
  • Pricing
  • Partners
    • Blog
    • Documentation
    • Roadmap
    • Self-paced learning
    • Webinar
    • Business process and workflow automation topics
    • Overview
    • Issues
    • Give feedback
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • User groups
    • Register
    • ·
    • Sign in
    • ·
    • Help
    Go To
    • Microsoft Power Automate Community
    • Welcome to the Community!
    • News & Announcements
    • Get Help with Power Automate
    • General Power Automate Discussion
    • Using Connectors
    • Building Flows
    • Using Flows
    • Power Automate Desktop
    • Process Advisor
    • AI Builder
    • Power Automate Mobile App
    • Translation Quality Feedback
    • Connector Development
    • Power Platform Integration - Better Together!
    • Power Platform Integrations
    • Power Platform and Dynamics 365 Integrations
    • Galleries
    • Community Connections & How-To Videos
    • Webinars and Video Gallery
    • Power Automate Cookbook
    • Events
    • 2021 MSBizAppsSummit Gallery
    • 2020 MSBizAppsSummit Gallery
    • 2019 MSBizAppsSummit Gallery
    • Community Engagement
    • Community AMA
    • Community Blog
    • Power Automate Community Blog
    • Community Support
    • Community Accounts & Registration
    • Using the Community
    • Community Feedback
    cancel
    Turn on suggestions
    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
    Showing results for 
    Search instead for 
    Did you mean: 
    • Microsoft Power Automate Community
    • Galleries
    • Power Automate Cookbook
    • Flow Failure Notifications

    Flow Failure Notifications

    03-09-2022 07:19 AM - last edited 05-06-2022 10:46 AM

    Super User takolota
    Super User
    14429 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    takolota
    Super User takolota
    Super User
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    Flow Failure Notifications

    ‎03-09-2022 07:19 AM

    Get email alerts with direct links to the flow run any time your flow fails by adding this set of actions to the end of your flow.

    Flowfailurpic.PNG


    Either download the template attached to this post & copy the Scope in the template, or copy the Scope action's code, navigate to the My clipboard tab on a new action and press Cntrl + V to get this Scope as a new action option.

    FlowFailCopyToClip.pngFlowFailCopyToClip2.png

     

     

    Scope Code To Copy & Paste Into Your Flow

    {"id":"fd3dfdb1-5fc7-4bb4-b830-978bffcb68b9","brandColor":"#8C3900","connectionReferences":{"shared_office365users":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_office365users/connections/4492902ae6154e088865fbb98252807a"}},"shared_office365":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_office365/connections/shared-office365-02d46624-0d5c-40fe-89f0-c5df-8c7ffde7"}}},"connectorDisplayName":"Control","icon":"data&colon;image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"Scope_Failure_Notifications","operationDefinition":{"type":"Scope","actions":{"Compose_Flow_run_link":{"type":"Compose","inputs":"@concat('https://us.flow.microsoft.com/manage/environments/', workflow()?['tags']?['environmentName'], '/flows/', workflow()?['name'], '/runs/', workflow()?['run']['name'])","runAfter":{},"metadata":{"operationMetadataId":"304e2c8e-c6d8-4bd0-ac4d-57951dd57763"}},"Get_my_profile_(V2)":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_office365users","operationId":"MyProfile_V2","apiId":"/providers/Microsoft.PowerApps/apis/shared_office365users"},"parameters":{},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{"Compose_Flow_run_link":["Succeeded"]},"metadata":{"operationMetadataId":"16453b92-e67e-40aa-acf4-fbd90183a4f0"}},"Send_an_email_(V2)_Failure_notification":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_office365","operationId":"SendEmailV2","apiId":"/providers/Microsoft.PowerApps/apis/shared_office365"},"parameters":{"emailMessage/To":"@outputs('Get_my_profile_(V2)')?['body/mail']","emailMessage/Subject":"Your @{workflow()?['tags']?['flowDisplayName']} flow failed","emailMessage/Body":"<p>Check your flow.<br>\n<br>\n<a href=\"@{outputs('Compose_Flow_run_link')}\">Flow Run Link</a>&nbsp;</p>"},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{"Get_my_profile_(V2)":["Succeeded"]},"metadata":{"operationMetadataId":"bd4b39c2-3462-4a00-b21d-d8ac056f00d2"}},"Terminate_Mark_flow_run_failure":{"metadata":{"operationMetadataId":"c3050a38-c258-4145-b3fa-4d5e80d70b67"},"type":"Terminate","inputs":{"runStatus":"Failed"},"runAfter":{"Send_an_email_(V2)_Failure_notification":["Succeeded"]}}},"runAfter":{"Compose_(All_Your_Flow_Actions_Here)":["Failed","Skipped","TimedOut"]},"description":"Set this Scope's Configure run after settings to \"has failed\", \"is skipped\", and \"has timed out\".","metadata":{"operationMetadataId":"072e1b99-2b98-4cdc-bb50-f9ef10d9a137"}}}

     

    watch?v=u9GhlSofXAI
    FlowFailureNotifications.zip
    Labels:
    • Labels:
    • Automated Flows
    • Button flows
    • Desktop flows
    • Scheduled flows
    Message 1 of 41
    14,429 Views
    15 Kudos
    Reply
    • All forum topics
    • Previous Topic
    • Next Topic
    • « Previous
      • 1
      • 2
      • 3
      • 4
      • 5
    • Next »
    takolota
    Super User takolota
    Super User
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎03-12-2022 07:18 AM

    Reza Dorrani Video on Flow Run Links: https://youtu.be/O97IdCbfMQI?t=1607

    Power Automate Expressions Guide:
    https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#w...

    Note that on flows run from end-user accounts, this will send the end-user an email. So make sure to add your own email address to the email action if it is a button-triggered flow.

    Message 2 of 41
    12,471 Views
    0 Kudos
    Reply
    jgathers
    jgathers
    Regular Visitor
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎03-21-2022 06:52 AM

    This seems very useful.  Can you show what is in the Compose steps?

    Message 3 of 41
    12,208 Views
    2 Kudos
    Reply
    takolota
    Super User takolota
    Super User
    In response to jgathers
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎03-21-2022 07:36 AM

    Hello @jgathers,

     

    Thanks, I was thinking of doing a brief explainer video incase that may help some people.

     

    But in the meantime, you can always import the flow, or copy the Scope code in the box above, Cntrl + V to paste it into the “My clipboard” options, select the Scope to paste it into the flow, then look over the formula in the Compose in your own environment.

     

    Thanks,

    Message 4 of 41
    12,204 Views
    1 Kudo
    Reply
    takolota
    Super User takolota
    Super User
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎05-06-2022 10:48 AM

    @jgathers 

    The video is now up on the main post.

    Message 5 of 41
    11,579 Views
    1 Kudo
    Reply
    WaynePeinke
    WaynePeinke Advocate I
    Advocate I
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎08-01-2022 12:52 AM

    This is useful but what do you do if the Flow is failing because of this error: "Error from token exchange: Runtime call was blocked because connection has error status: Enabled| Error, and office365 is in the block list. Connection errors: [ParameterName: token, Error: Code: Unauthorized, Message: 'Failed to refresh access token for service: aadcertificate."

    In this case the flow can't send an email due to the token refresh error. The flow also cannot create a new list item in a SharePoint list so that is also not an option.

    Since the Flow runs under the context of the user and the reason is flow is failing is because of a user authentication issue, you cannot perform any actions in the flow.

    This is the most common reason why my flows are failing... Any ideas how to get around this and create or send an alert of some sort?

     

    Message 6 of 41
    10,189 Views
    0 Kudos
    Reply
    takolota
    Super User takolota
    Super User
    In response to WaynePeinke
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎08-01-2022 07:58 AM

    @WaynePeinke 

     

    I’ve encountered errors where say an Outlook connection will break & that messes up any in-flow method of sending error notifications. But they are generally easier to spot as multiple flows will start failing at once if that happens.

     

    But I’m not sure I’ve ever seen your specific error. “office365 is on the block list” sounds like your IT department may have some weird setting potentially blocking some basic functionality.

    Message 7 of 41
    10,178 Views
    0 Kudos
    Reply
    neilcotton
    neilcotton
    New Member
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎08-12-2022 07:03 AM

    Hi Takolota, 

    Thank you for this (It's hard to believe there isn't a simple alert on failure option for a flow to notify an owner/administrator). Anyway,

    My question is does your solution work if there is an error anywhere in the flow. When I add the node at the bottom, and set to "Run After", it suggests it is only monitoring the previous step, or is this not the case?

     

    Many thanks

     Neil

    Message 8 of 41
    9,901 Views
    4 Kudos
    Reply
    takolota
    Super User takolota
    Super User
    In response to neilcotton
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎08-12-2022 07:50 AM

    @neilcotton Thanks

    If any previous action fails, then the action before the Failure Notification segment should skip, thus it will run because of the “Is Skipped” run after setting.

    Message 9 of 41
    9,897 Views
    3 Kudos
    Reply
    neilcotton
    neilcotton
    New Member
    In response to takolota
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎08-12-2022 07:59 AM

    That's a great point 🙂 I hadn't thought about it that way.

    Thank you again.

    Message 10 of 41
    9,894 Views
    2 Kudos
    Reply
    • « Previous
      • 1
      • 2
      • 3
      • 4
      • 5
    • Next »

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Pages
    • Power Automate
    • Power Virtual Agents

    • Sign up free
    • Sign in

    Browse

    • Templates
    • Connectors
    • Partners

    Downloads

    • Mobile
    • Gateway

    Learn

    • Documentation
    • Learn
    • Support
    • Community
    • Give feedback
    • Blog
    • Pricing

    • © 2023 Microsoft
    • Contact us
    • Trademarks
    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Terms & conditions
    California Consumer Privacy Act (CCPA) Opt-Out Icon Your California Privacy Choices