Best Practice For Creating Cloud Flows With Microsoft Power Automate
Solutions Director - Public Sector|Kerv Digital
Published 06/07/22 under:
Kerv Digital’s Solutions Director lays out the best practices for creating cloud flows when using Power Automate from the Microsoft Stack
Power Automate from the Microsoft Stack is a fantastic tool whether you want your automations to be triggered automatically, instantly or via a schedule.
Types Of Cloud Flow
- Automated flows – An automated cloud flow is triggered by events such as an incoming email from a previously specified individual or perhaps a mention of tour organisation on social media.
- Instant Flows – Instant cloud flows are there for repetitive tasks from either desktop or mobile devices. As an example, they’re capable of sending reminders to your different teams with the push of a single button on your phone.
- Scheduled Flows – Scheduled Cloud Flows are for reoccurring automations such as a daily data upload to SharePoint, Dataverse… or in my case filling my timesheets!
A Step By Step Guide To Creating Cloud Flows With Power Automate
- Connection References – Still in Preview at time of writing and the ALM will surely smooth out soon but meanwhile you still need to make sure you are documenting exactly what they are and how they are connecting (via the user, via a service principal etc) and re-use. You might be limited to the scale of reuse during Preview but having 3 different connection references to the same Dataverse table in a single flow? You’re creating work for yourself!
- Secured Inputs & Outputs – It’s absolutely fine to leave this step till after the debug stage but you definitely need to put some thought into what data is visible to people allowed to view your Flow’s run history. Hit the ellipsis in the top right of your action, select Settings and toggle on Secure Inputs and Secure Outputs. Your organisation likely has its own rules on what is considered sensitive but if you’re connecting to Key Vault or working with HR data, I’d be flicking those toggles!
- Actions Should Have Meaningful Names – When you’re deep in the loops it’s far too easy to lose track of context! Assigning memorable and meaningful names will pay dividends later down the line. You may already have naming policy elsewhere where you work so agree a convention between you and stick to it to help each other out. I’m a fan of descriptive Pascal Case myself.
- Consider Concurrency In Loops – For an immediate performance boost, head back to Settings and enable concurrency on your loops. Remember it does not tend to play well if you are using variables in there but I find it’s sometime beneficial to engineer away from a variable if it means I can knock 80% off the run time!
- Don’t Nest Too Deep – I know how hard it is to avoid sometimes but try to avoid nesting too deep. PA itself will impose a limit (8 at time of writing) but your bleeding eyes 10 weeks later when you’re debugging probably have a lower threshold!
- Error Handling – Do you know what will happen if a step fails? Have you captured said failure? Use Configure Run After to have different follow-on actions depending on the success or failure of key Actions. Stephen Siciliano wrote a great blog all about this.
- Optimise & Look For Efficiencies – It probably goes without saying but you should always aim for the absolute minimum amount of calls needed to do the job, especially where you are calling potentially slow or expensive APIs. A good example of this is querying Environment Variables, should that be six calls for the six variables or could you make one call with a well thought out Dataverse filter and an array?
- Variables Should Have Meaningful Names – I’ve already mentioned that your steps should have meaningful names but the same also goes for your variables. A quick tip here, if you are using PowerApps as your trigger, put “ask in PowerApps” dynamics expressions into an Initialise Variable action and give both the action and variable a good name to reap a much more meaningful prompt to your users over in their Canvas Apps.
- Cloud Flows Should Be In Solutions – It’s getting better all the time but it can still be confusing to try and find specific flows or work out who can do what with them. Not only do Solutions help you move your creations around but they also help you organise your work into logical features or story collections.
- Always Think Scale – Sure your cloud flow works when there are only ten records in your table but what happens when you’re dealing with 10 million? This is where Filters and Tops on Lists, timeouts (and concurrency) have to come into play.
- Keep It Simple Stupid – It’s an old adage but a good one. If you’re seven nests in then maybe it’s time to start thinking about breaking your cloud flow out into smaller, more discreet functions.
- Comments – Don’t forget to comment your actions. Like many useful features Add a Comment it underneath that ellipsis in the top right.
- Consider Performance / Readability – It’s a fine line and adding 10 strings together in a loop might be easy to understand but that might be taking 6 seconds whereas an expression utilising join is done in milliseconds. If you have a using waiting for the outcome of this Flow, go for speed and comment and document well.
You might also be interested in
Have a question?
"*" indicates required fields