Try Catch Finally in Logic Apps.

On a regular basis I refer Microsoft Flow developers to my Try-Catch-Finally-patttern, but what if you need to use LogicApps. Can you use the same pattern?

Well, you could but …

Try Catch Finally shown in Flow

There is a small catch.

 

When I use my Try Catch Finally template in Logic Apps, I found that it isn’t possible to include details about the runs in the email sent when there is a problem with my flow as I can build a URL to my flow run.

Building a run URL within a flow

 

In LogicApps however you cannot generate a Url to a flow run as there isn’t any url to go to. Azure’s blades showing the Logic App run doesn’t have a Url to point the user to. There is however an Id:

Run history in Logic Apps

This Run Id you can find using the following expression

workflow()?[‘run’]?[‘name’]

Generating the workflow run id in Azure

The user checking out the failure can now use this Id in the email to filter the LogicApps runs in Azure.

 

 

 

 

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as a Principal Architect at HybrIT Services Ltd. You can contact me using contact@sharepains.com

3 thoughts on “Implementing a Try, Catch, Finally in Logic Apps”
  1. Nice work Pieter: my try, catch and finally works really well based on your model. I put a terminate at the end of my catch to the finally scope doesn’t ever run. like you, I use the workflow()?[run’][‘name’] in my email to the user ( for them to quote) but as you say, there is no link to the item. Do you use Azure Insights or Power BI to capture more info on runtime errors?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue Reading