Matthew Chestnut is a Senior Consultant at ThreeWill. He has over 25 years of software development experience around enterprise and departmental business productivity applications. He has a proven track record of quality software development, on-budget project management and management of successful software development teams.
And how to make Power Automate Flows or Power App Forms you create easier to understand.
On a recent project, I worked on enhancing a series of Microsoft Power Automate Flows used to create Excel spreadsheets and a Microsoft Power App canvas form used to manage the application data. There was also an additional model-driven app used for behind-the-scenes administrative access to the underlying data.
Here is some guidance on how to approach understanding these Power App artifacts and things you can do to help others work on flows and apps you create.
General Guidance
Naming Conventions
Follow reasonable naming conventions for actions, flows, variables, screens, data cards, etc. Using meaningful names helps those not intimately familiar with the business process understand what the object is referencing.
Power Automate Flows – Description Field
Power Automate Flows have a description field; use it to summarize what the flow does.
Power Automate Flow Actions – Notes
Power Automate Actions have a Note property that is extremely useful to describe what that specific action is doing.
PowerApps Code Comments
PowerApps code comments are the equivalent of Power Automate Action notes. When possible, explain what your code is doing, especially if the code is not obvious or intuitive.
Viewing “The Code”
Behind the scenes of Power Automate Flows and PowerApps canvas apps is a set of configuration files, The Code, that defines the actions and behaviors of the flow or app.
For me, as a developer, having a view into the behind-the-scenes configuration data is extremely handy in understanding what that application is doing.
Power Automate Flows – using CLI for Microsoft 365
As a developer, I find it very useful to be able to scan and review the “source code” of a Power Automate flow. I found the CLI for Microsoft 365 an easy way to extract flows from the environment.
Login to the tenant – m365 login
After installing the CLI, use the login command to connect to your tenant:
m365 login
Get “name” of the environment – m365 flow environment list
The environment name you need is the GUID value that uniquely identifies the environment. This environment name differs from the user-friend “Display Name” property. To get the GUID value, use something like the following:
m365 flow environment list –query ‘[?contains(displayName,`default`)] .name’
List the flows – m365 flow list
Once you know the environment GUID value, you can use that value to list the flows in the environment.
(m365 flow list –environment “989c2b99-a700-43a0-8873-897ff946ef63” –asAdmin –output json | ConvertFrom-JSON) | select name, displayname
Export the flows – m365 flow-export
Now, take that information and extract the “source code”:
Power Automate: XrmToolBox Flow to Visio Builder
See: https://www.xrmtoolbox.com/plugins/LinkeD365.FlowToVisio/
I use the XrmToolBox for a variety of Microsoft Dataverse tasks.
The Flow to Visio Builder tool can convert a flow into a Visio diagram.
PowerApps: Manually Export the App
As of this writing, there isn’t a PowerShell or scripting solution to export a form.
So, you must do so manually via https://make.powerapps.com.
See: https://docs.microsoft.com/en-us/power-apps/maker/canvas-apps/export-import-app
Once the ZIP file has been exported, you can un-ZIP the package and unzip the .MSAPP file to get “The Code” for the app.
See: How to get Source Code files for Power Apps Canvas apps
• https://powerapps.microsoft.com/en-us/blog/source-code-files-for-canvas-apps/
• https://techcommunity.microsoft.com/t5/microsoft-365-pnp-blog/how-to-get-source-code-files-for-power-apps-canvas-apps/ba-p/2308822
• http://powerappsguide.com/blog/post/new-easier-way-to-pack-unpack-canvas-app-source-code
• https://www.matthewdevaney.com/power-apps-source-code-tool/
Using Prettier to format The Code
• See: https://prettier.io/docs/en/install.html
Now that you have a filesystem that includes Power Automate Flow actions in JSON format and/or Power Apps YAML files, using a file format like Prettier makes it easy to view the code.
After installing Prettier, you can format files in directory structure with the command:
npx prettier –write c:/dev/myfiles
PowerApps: Co-authoring in canvas apps (experimental)
• See: https://docs.microsoft.com/en-us/power-apps/maker/canvas-apps/git-version-control
As the documentation states…You can now use Git version control to enable more than one person to edit a canvas app at the same time. With this feature, others won’t get locked out of the app while one person is editing it. As changes are made and synchronized, they’re automatically merged with other changes and made available to all others editing the app. This feature is a first step towards the Microsoft Office style of co-authoring experience for canvas apps.
Use with Care! Keep in mind that this is an experimental feature, so your mileage may vary. Merge conflict resolution can be tricky if you have changes from multiple developers that are not able to be automatically merged. This can leave your application in an unusable state until the merge conflicts are manually resolved.
Having said that, what I like about this feature is the ability to review “source code changes” in DevOps for your PowerApps.
Related articles:
- Power Automate Flows – Random Tips, Tricks, and Pain Points
- Cox Enterprises Modernizes Corporate Tax Application
CONTACT THREEWILL FOR ASSISTANCE WITH YOUR POWER PLATFORM TODAY!