Welcome to the Power Automate Coding Standards For Cloud Flows.
In this guide you will find 60+ pages of coding rules, guidelines and best practices I use everyday to create Power Automate cloud flows. I have spent the last 3 years building Power Automate flows every day. Now I want to share the knowledge I’ve gained in this set of easy-to-understand, actionable examples.
Power Automate already has an official set of cloud flow coding standards released back in 2019. So why did I make my own? A few reasons:
- I wanted an updated set of standards and guidelines for 2024 that includes all of the latest features
- These coding standards can be continuously improved as new Power Automate features hit “general availability” in 2025, 2026, 2027 and beyond
- Readers can leave comments on my website describing their own best practices which I can incorporate into future versions
I hope you enjoy my Power Automate Coding Standards For Cloud Flows.
Table Of Contents
- ð Naming Conventions
- ðŠ Variables
- ð Commenting Code
- 𧶠Connection References
- ð Error-Handling
- â¡ Performance Optimization
- Enable Concurrency Control In Apply To Each Loops
- Execute Flow Actions In Parallel Branches
- Use Filter Queries When Retrieving Large Datasets
- Reduce Table Sizes By Selecting Columns
- Stay Below The Data Connector API Limits
- Identify Bottlenecks With Process Advisor
- Favor Compose Over Declaring Variables When Creating Arrays
- Exploit Batch Update APIs
- Avoid Using On-Premise Actions
- ð Flow Architecture & Design Tips
- Writing Reusable Code
- Create Child Flows To Store Repetitive Logic
- Favor Custom Connectors Over The HTTP Action For Reusability
- Always Build Flows Inside Of A Solution
- Security Architecture
- Secure Inputs/Outputs For Passwords, API Keys and Secrets
- Enable Elevated Permissions By Configuring Run As User
- Platform Considerations
- Be Aware Of Power Platform Request Limits
- Decide Whether To Use Premium Flow Connectors
- Keep The 30 Days Flow Duration Limit In Mind
- Designing Flow Triggers
- Replace The Power Apps V1 Trigger With V2
- Apply Select And Filter Criteria To Automated Triggers
- Create Advanced Trigger Conditions With Flow Expressions
- General Coding Patterns
- Flatten Nested IF Condition Actions
- Eliminate Unnecessary Apply To Each Loops
- Generate Fetch XML For The Dataverse List Rows Action
- Use A State Machine Pattern
Questions?
If you have any questions about 2024 Power Automate Coding Standards For Cloud Flows please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.
Hi Matthew, thank you for the great content as always.
I just want to let you know that the link in Error-Handling is pointing to the Power apps Guide
https://www.matthewdevaney.com/power-apps-coding-standards-for-canvas-apps/power-apps-standards-reviewing-canvas-apps/
Francesco,
I appreciate you alerting me to this note. The fix is now made and should appear once the site cache refreshes.
Don’t worry, just a little act of service after all the help we got from your blog in our daily job.
I think that Performance optimization is wrong too, the link send me here.
https://www.matthewdevaney.com/power-apps-coding-standards-for-canvas-apps/power-apps-app-theming-guidelines/
Thanks. Iâve gone and fixed this one too. Try to clear your local cache and hopefully it will be resolved now, if not soon.
Greate job Matt, tx for sharing such useful insights.
Eric,
Thank you for taking the time to send me a nice comment ð
Hi Matthew and thanks for sharing your knowledge. In your guide you have a section named “Assign Connection Ownership To Service Accounts” but I miss some information there. It seems that you managed to log in as a service principal in your screen shot, but I don’t understand how. Thanks in advance.
Hi Matt,
I have implemented the error handling in flows.. Life Saver, something I wanted to point out, not sure if the json returned is different for each action, or if it changed since you put this out,but I had to edit the code for the error message.
instead of ?[‘error’]?[‘message’]
I had to do: [‘body’]?[‘error’]?[‘message’]
just wanted to pass that along
Darren P,
Yes, that’s a great point. There seems to be two different paths to the error message.
Isn’t the 2nd one [‘outputs’]?[‘body’]?[‘error’]?[‘message’] though?
hmm mine did not have the [‘body’]
I had: [âerrorâ]?[âmessageâ]
and: [âoutputsâ]?[âerrorâ]?[âmessageâ]
but I did share it out to some peers, maybe they were playing around with it… either way THANK YOU very much!!!
Darren,
Hey, you’re welcome dude!
Just wanted to let you know that your suggested naming convention for actions ([action name]: [details]) doesn’t work in the new Power Automate editor. Semicolon is accepted, but colon is not.
Roland,
Thanks for letting me know. The new Power Automate editor has many bugs right now. I donât recommend using it until Microsoft releases a more stable version.
Hi Matthew, thank you for this lifesaver of a guide ðð» I was wondering if you were considering posting this as a collection of Markdown files in a GitHub repository so community could help you with maintaining and expanding the guide?
Marcin,
No, I do not have any plans to open source this coding standard. This standard describes my opinion on how I believe Power Automate flows are best coded. It represents my vision for creating flows that I wanted to communicate to the community.
Matthew – thank you for your hard working in keeping this site. It has been so helpful for me as a Jr. Developer.
Hey Matthew, just subscribed.
Appreciate the effort you have put into writing this up for us, I run a blog too so I know how difficult it can be!
Do you happen to have a cheatsheet for Power Automate Desktop by any chance? I work as a RPA developer and I can see that PAD doesn’t come with a framework like UiPath does so I’d appreciate it if you could share your insights on the tool if you’ve used it.
What’s the best way to move a flow from dev to user testing to production? We use DevOps for our SQL code, deploying to different servers for the different uses. I’ve developed a flow which is now in production, but if they need a change, I have no way of making it and letting them test it before moving it to production, I’m editing the production flow.
I created copies of my flows that connect to our different database servers, but the flows also use Dataverse tables, and I don’t know how to create dev/uat/production versions of that. While the copies will ultimately send data to dev/uat/prod servers, they all use the same production Dataverse tables.
I saw something about solutions and environments. Is that the only way to do it? And if I understand right, creating more environments costs more money, correct?
Just trying to figure out the best way to move something through the development cycle like we do with our SQL code. Thanks!