In this post I’m going to give 7 golden rules of Flow development. Within Power Automate it is all too easy to develop Flows and forget about some standards that you might want to follow.
Name your actions
The first one of the golden rules of Flow development is the way you name your actions. It can be very important, if you want your flows to be understandable by someone else.
In the above example you will not be able to guess what this flow is doing. Simply because the the actions weren’t named correctly
Rename your actions but keep the types
The other thing which is important is that you keep the original action name. In the example of variables it might be useful to know which actions are initializing variables and which ones are setting variables.
For Variables this might not be that important but if you now consider the the actions in a SharePoint connector and you can use different actions to do the same thing then it might help you. As an example flows can use a Sent a HTTP request to SharePoint or a Update Item action to update your SharePoint list items. If you want to make your Flows more generic then it might help if you can identify the less generic actions quickly
Use error handling in all your flows
I’ve written many posts about the Try Catch Finally pattern. The golden rules of Flow development had to include a reference to one of my Try Catch Finally pattern post.
Avoid nested loops
Many times I see people use nested loops in Flow. They can be difficult to avoid, however they are very slow. Shown below,a flow that collects tasks and then collects details of the people assigned a task.
Rather than the above it would be better to create two Apply to each tasks where one feeds the other.
One way to do this can be by using the Compose action in an Apply to each as described in the Compose actions inside apply to each steps post.
Replacing apply to each steps with a Select action can also be a great tactic for speeding up your flows. For an example of this please have a look at Convert your time faster in Power Apps to all time zones using Power Automate.
Avoid variables (in branches)
When you use parallel branches and you use variables then branches will wait for each other. This of course doesn’t help the performance. If possible try to use compose actions instead to hold information.
When variables need to change throughout the run of the flow then variables may need to be used, but make sure that you think twice before using the variables.
For the more advanced developers I would also like to include a link to John’s http://johnliu.net/blog/2018/10/hiding-your-microsoft-flow-valuables-i-mean-variables-out-of-sight
It is very easy to use update actions to update SharePoint list items, however during design time Power Automate will need to know the field details of your list. This means that you can’t soft code the site url and list name.
Using the Send an HTTP request to SharePoint action is easier as the update details is all made up by text/json. For more details see SharePoint REST API for low code developers.
In many of my Power Automate projects I’ve been replacing the easy to configure actions with the harder to configure Send an HTTP request to SharePoint actions. It will be worth it if flows are developed straight away with HTTP request actions during the first development phase.
Sometimes it can help to add comments to actions. It does take a lot longer to develop your flows therefor you could leave it to the minimum. It is however important to leave the comments when actions need further explanations
Nothing is worse than someone else developing a complication flow and then you have to pick up the mess risking undoing something clever done by someone else.
Golden rules of Flow development thoughts
Although using any of the above golden rules, there is also often a need to develop your flows fast. Always consider fast development vs best development. Both ways can be suitable at times.