If you’ve ever made a large Microsoft Flow with multiple connectors you’ll have noticed how untidy or messy it is. A useful feature that I’ve recently found is the ‘Scope’ control which will neatly confine your methods/actions to a well-defined structure.
As you can see this flow is running multiple sets of logic and to an outside user who hasn’t seen the Flow before it would look like there’s no structure to the flow and it isn’t exactly clear what it is doing. To solve this, we can use the control ‘Scope’.
The above Microsoft Flow can be contained using Scope as shown below. Scope groups logic together and makes it easier for a user to learn the logic who hadn’t seen this Flow before. Below is how I used grouping on the Flow using Scope.
Another useful feature in scopes is ‘Configure Run After’. When you have multiple scopes consecutively running you can can choose to run a scope depending on the outcome of the last scope.
In this example we want to only run ‘Retrieve Accounts and Update with Today’s Weather’ if ‘Get Christchurch’s Weather’ is successful. This is shown in the below screenshot:
You can define when to run the scope depending on the previous scope’s outcome. This is especially useful when sending web requests that can fail, using scopes we are able to replicate a try, catch, finally that you’d use in C#.
Lastly, using scope is an easy way to copy and paste multiple actions in one sequence. To learn about copying actions see this blog here.
You simply ’Copy to my clipboard (Preview)’ and then paste it by selecting ’Add Action’ and then under the ’My Clipboard’ tab your copied control will be there:
As you can see this is now a nicely formatted flow, that has a clear structure and will allow an outside user to easily understand the purpose of the different sets of logic involved in the flow.