Skip to main content
Power Automate
    • Connectors
    • Templates
    • Take a guided tour
    • Digital process automation
    • Robotic process automation
    • Business process automation
    • Process Mining
    • 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 Mining
    • 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
    • Re: Flow Failure Notifications

    Re: Flow Failure Notifications

    10-11-2022 09:18 AM

    DappMan
    Regular Visitor
    727 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 44
    23,631 Views
    19 Kudos
    Reply
    • All forum topics
    • Previous Topic
    • Next Topic
    • « Previous
      • 1
      • 2
      • 3
      • 4
      • 5
    • Next »
    JC04
    JC04
    New Member
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎08-31-2022 09:47 AM

    This is great! Thanks for sharing. Is there a way to get notifications on flows that just keep running?

    Message 11 of 44
    943 Views
    2 Kudos
    Reply
    takolota
    Super User takolota
    Super User
    In response to JC04
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎08-31-2022 10:42 AM

    @JC04 

    I would think you could somehow set the timeout policy for any potentially long-running actions to some set amount like PT1H. Then those would time-out & trigger the failure notification. But when I tried testing that it didn't really work as intended.

    If like me, you can't figure out anything with the built-in action timeout policies, then a more definite work-around is to create a parallel branch at the start of the flow, set a Delay action with your desired time-out limit, then add a copy of the failure notification scope below that (This time with the Run after set to "On Success"). Then that will trigger the notification & flow termination if the flow runs longer than you want.
    Timeoutworkaround.jpg 

    EDIT: As Wayne says below, you will also need to add a Terminate set to “Success” at the end of the other branch with all your regular flow actions.

    Message 12 of 44
    938 Views
    2 Kudos
    Reply
    WaynePeinke
    WaynePeinke Advocate I
    Advocate I
    In response to takolota
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎09-01-2022 12:31 AM

    Your parallel branch will always run and send a failure notification unless you put a Terminate with success at the end of your left hand side branch. 

    Message 13 of 44
    925 Views
    3 Kudos
    Reply
    JC04
    JC04
    New Member
    In response to takolota
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎09-01-2022 03:03 AM

    Thanks so much I will try that.

    Message 14 of 44
    917 Views
    2 Kudos
    Reply
    JC04
    JC04
    New Member
    In response to WaynePeinke
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎09-01-2022 03:04 AM

    Great point. I will add that as well.

    Message 15 of 44
    917 Views
    0 Kudos
    Reply
    DappMan
    DappMan
    Regular Visitor
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎10-11-2022 03:35 AM

    Thanks a lot for the tip on this thread.

    I have several places in my flow where I have defined timeouts. I am trying to figure out how to only get notified about the flow's failure and not timeouts. All of my flow's logic is contained in a scope. Just after the scope are the actions to notify me if the flow fails.

    I have configured the run-after to only occur if the scope fails. However, for some reason, if any action within the scope times out, the scope shows as failed.

    How do I setup the flow such that I only get notification if the flow actually fails and not when it times out?

     

    Thanks. 

    Message 16 of 44
    743 Views
    0 Kudos
    Reply
    takolota
    Super User takolota
    Super User
    In response to DappMan
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎10-11-2022 04:39 AM

    @DappMan 

     

    You’ll want to do something like initialize a variable & after each action you want to allow a timeout, create a parallel branch to Set the variable to True. Set that branch & action to only run on a timeout.

    Then in the Flow Failure Notifications Scope, you can put all the actions in a Condition to only run when that variable does not equal True.

    Message 17 of 44
    733 Views
    1 Kudo
    Reply
    DappMan
    DappMan
    Regular Visitor
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎10-11-2022 09:18 AM

    thank you very much @takolota . I have implemented your suggestion and that should definitely solve the time out issue. Thanks again.

    Message 18 of 44
    727 Views
    2 Kudos
    Reply
    Attila_the_Hun
    Attila_the_Hun Advocate I
    Advocate I
    In response to neilcotton
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎10-23-2022 06:54 PM

    I was going to ask this very same question. Thanks.

    Message 19 of 44
    690 Views
    0 Kudos
    Reply
    Attila_the_Hun
    Attila_the_Hun Advocate I
    Advocate I
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎10-23-2022 06:56 PM

    Tyler, thank you so much for creating this, and then even more so for sharing it with the community.

     

    Very much appreciated.

    Message 20 of 44
    686 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
    Consumer Privacy Act (CCPA) Opt-Out Icon Your Privacy Choices