Power Automate Exchange

Please login or click SIGN UP FOR FREE to create your FlowUG account to join this user group.

Implementing Try,Catch and Finally in Power Automate

By Nagaraja Emmadisetty posted May 04, 2020 06:37 AM

  


No matter how great we are in programming , sometimes our code has errors. They may occur because of our mistakes, an unexpected user input, an erroneous server response, and for a thousand other reasons.

So handling these exceptions is very important . Anyone who has even a little experience with programming knows the “try – catch” to handle these exceptions.

The same approach can be used in Power Automate / Flow to handle exceptions. In fact, we have a template in Power Automate templates gallery and it can be used straight away.

https://flow.microsoft.com/en-us/galleries/public/templates/e8e028c6df7b4eb786abdf510e4f1da3/try-catch-and-finally-template/

Try, Catch, Finally blocks in the above template are nothing but scope controls

Scopes are a simple way to group two or more actions together. When you put actions inside a scope they can be visually collapsed so that you cake make the presentation inside of the designer much simpler.

Let’s dig into each block in the template.

Try – The “Try” scope should contain all the actions from the main flow of the process.

Catch – The “Catch” scope is configured to run after “Try” block is failed. This is implemented using “Configure run after ” feature .





Finally – The “Finally” block should run no matter what happens in the previous action.



Using “Scope” and “Configure run after” feature, we can implement try ,catch pattern in Power Automate easily.

Hope it helps.

0 comments
7 views

Permalink