Sorry, the blog has been quiet, there is only so much time to spend on out of work activities, and this tool has been my time sink in the last 6 weeks. Not complaining, loved getting back to my routes.
Documentation for many consultants is the worst part. Implementing stuff is fun, taking the same amount of time documenting what you have delivered is not. With this in mind, I created the ERD Visio Builder – XrmToolBox addon. After this, and knowing that creating Visio was pretty straight forward, I turned to another part of the Power Platform that looks a bit like a Visio diagram - Power Automate Flows.
When you store Flows in Solutions (and you should) they are kept in the CDS environment as a JSON text field. This allows me to parse the JSON, generate appropriate Visio shapes and give you a copy of a Flow as a document you can use as a snapshot in time of what the flow was like. Obviously doesn’t replace the editor, but gives you all the information you coded as a reference which is certainly better than a bunch of screenshot images.
In addition, for those flows not in solutions, or environments that there is no CDS, there is the option to connect directly with the Flow API, using an App and tenant ID as well as an OAuth token. Not the prettiest of solutions, but required to get at the flows that are not in solutions.
The tool can be found here.
TLDR;
I created a tool to generate Visio diagrams from your Power Automate Flows.
New features 17/02/23
As highlighted here I have added Solutions to the tool, so that you can select a solution & create a Visio with all the flows in it in a couple of clicks.
This update also added more actions that were missing appropriate images.
New Features 28/11/21
The ability to document any Comments, a preview feature from the Power Automate team. has been added.
Also, several Community features including
- Reduced the border to the bottom edge and corrected a few dimensions
- SQL Actions with appropriate actions
- Append to String etc use proper icons
- Open file after creation
- Multi-Select for creation of Visios
- Options drop-down for concurrent, tracked properties
Walkthrough
Load the tool and you should be present all the flows in your environment that are solution-based. This is reading from the WorkFlow entity in CDS.
Choose a file to save the flow as.
Hit Create Visio and that’s it. All being well, should get a prompt telling you it has generated your Visio. Go find the file and open it.
Demonstration
The flow I created for connecting Alexa to Field Service looks like this.
If you expand the first Scope, there is a condition in there
The detail for the second condition statement has a Switch statement within it, each setting a variable before responding to the user.
As Flows go, this is not that complicated, but documenting it, opening up each of the actions, taking screenshots, is painful, and as you can see by the last screen shot, requires a magnifying glass.
With my tool, I generate a Visio diagram. The equivalent is shown with some highlights here. Each shape is made up of several other shapes to allow me to template them. In the HTTP Request, you can see that the schema is truncated. I have “stolen” the shape to prevent overflow here http://visguy.com/vgforum/index.php?topic=7997.0. Thanks to Yacine for the assist.
You can change each shapes size to fit your data, and drag that yellow dot up or down depending on whether the information is relevant to you.
As you can see from the next picture, if you expand some of the shapes, they can contain a lot of information, in this case, the schema of the triggering call. Up to you if you want to include this, but the data is there if you do.
Each action in the flow is documented, either with a template or generic action (no pretty colours or logo) where I have not managed to go through all the actions and possibilities. I do believe this will be like painting the Forth bridge, a never ending task.
There are some special ones, Scope is the first. In Flow, it is a box around your actions. I decided to just place a Scope marker at the top and bottom of the actions that are grouped together. In this image, you can also see the If condition. I document both sides and have an end If action to show you where the actions for each stop, bringing together connections.
In the next image, you can see a switch statement. This also highlights one of the limitations. If you have lots of actions, not connected, on the same line, they can overlap. Easily fixed in Visio by using Design/Re-Layout Page option. I have options to resolve this but will take a little more time.
Pre Re-layout page, with overlap
Post Re-layout page, no overlap
Each case statement has the condition that it is matching on and comes together with a closure action.
Connect to Power Automate API
Not everyone uses solutions, not everyone can as Solutions are only available on those environments with a CDS backing it. That is why I have also provided an option to connect to the Power Automate API.
Firstly, you need to register an Application in your Azure tenant. This is documented here. The only caveat is that the permissions required is Read on Flow, using the Flow service.
When you click on connect to Flow API, you get a little popup box where you populate the guids from the configuration. As you can have many environments, you also have the ability to add multiple connections. Hit the + to add your first, or select one of the saved ones to edit. The label is a name for the connection.
In Azure, Client / App Id is the yellow redacted line, Tenant is the red
The Environment comes from your URL that is shown when editing a flow, the purple bit below.
Lastly, the Return URL is the one listed against an App configuration. You can use any url, even localhost.
WARNING
This needs to be a desktop application, rather than a web application!
Once you are done, populated all the fields something like this. The
Hit OK, where you will be presented with an OAuth screen, asking to login with an account.
Choose the appropriate account or use another account and login. If all is well, you will be presented with a list of flows not in a solution.
And then you are able to document those flows too!
You can also use the dev App Config. This is for development/testing only, so don’t use to connect to production environment, but eases the complexity. You only need the Environment and Tenant Id for this.
Connect to Logic Apps
As Logic Apps are the big brother of Power Automate Flows, you can also use this tool to document Logic Apps.