While creating Power Automate Flows (previously known as Microsoft Flow), I learnt a lot about deploying and constructing them efficiently and effectively. There are many ways to improve your Flow so that it runs better and it’s easier to deploy. This is how I make deployments of my flows easier using variables.
When setting the connection string for a Connector (E.g. SharePoint Connector, note: you can use this method for any connector) it is better to use a variable in the URL field. The example below demonstrates initializing the variable, retrieving and setting the connection string variable from data stored in Dynamics 365 and then applying the variable to the URL field so that the SharePoint is dynamic per Environment.
As you can see this Flow is triggered when an HTTP request is received, it then retrieves the SharePoint URL from the Dynamics 365 environment and is used in the SharePoint connector on the action ‘Get Files’.
To set the ‘Site Address’ part of the SharePoint connector you select ‘Enter custom value’ as shown below:
Then you can use the value from your ‘Initialize SharePoint URL’ variable as shown below:
When there are multiple actions all connecting to the same environment you would usually have to manually set each of these when deploying to a new environment. You may have a DEV environment, a UAT environment and a Production instance and when deploying you must set the connections to the relevant environment. If you have reference data stored in your Dynamics 365 instance you can retrieve it from there and place it in the ‘Site Address’ so you only set it up once.
This will improve the accuracy and speed of your Flow deployments! Have a go and notice the smooth improvements.