Welcome to new things

[Technical] [Electronic work] [Gadget] [Game] memo writing

How to catch errors in Microsoft (Office365) Flow

When using Microsoft Flow normally, if some error occurs in the middle of the process, the action stops there.

For example, suppose you have a Flow that retrieves a list of users from SQL Server and sends a Slack to those users.

How to chatch errors in Microsoft (Office365) Flow

If there is a user in the user list, it runs fine, but if there is no user, an error occurs and Flow stops there.

How to chatch errors in Microsoft (Office365) Flow

To catch the error and continue to execute the next action, use the [Control]-[Scope]. action.

What is Scope?

A scope is a grouping of a series of actions.

If an error occurs in the middle of a series of actions, you can write exception handling that aborts the action, exits the scope, moves on to the next action, and handles the error in the next action.

treatment

  • Add a "scope" action with [Control]-[Scope].
  • Put the group of actions you want to catch errors in the "Scope" field.

    • Here we have included "Apply to each" to send a Slack to each user in the user list
  • Add a new "Scope" under the above "Scope" as a place to catch "Scope" errors
  • In the newly added "scope", add an action to be taken when an error occurs

    • Here we have added an action to send error messages to Slack
  • In the upper right corner of the newly added "scope", set the execution condition to "failed" for the scope above.

setting (of a computer or file, etc.)

Microsoft (Office365) Flow でエラーをチャッチする方法
エラーをキャッチしたいアクションをくくるスコープと、キャッチしたエラーの処理を行うスコープを追加
Microsoft (Office365) Flow でエラーをチャッチする方法
上のスコープがエラーになると、下のスコープが実行されるように設定
This ensures that if an error occurs in the upper scope, Flow will not terminate, but the lower scope will be executed, and actions below the lower scope will continue to be executed as well.

Microsoft (Office365) Flow でエラーをチャッチする方法
上のスコープでエラーが発生しているが、下のスコープが実行されている
Microsoft (Office365) Flow でエラーをチャッチする方法
上のスコープでエラーが発生すると、下のスコープが実行されれ、エラーのSlackが送られる

supplementary explanation

  • In order to continue Flow execution after an error occurs, it is necessary to set up not only the initial scope, but also the scope that will receive the error.
  • To ignore errors, leave the scope below empty.
  • It is possible to separate actions by scope success or failure, but it is a bit time-consuming to type the formula by hand, so I omitted it. Please refer to the reference article for how to do this.

Reference Articles

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com

www.ekwbtblog.com