DEV Community

Cover image for Power Automate: Cloning flows in same tenant pointing to separate sources
Surjyo Bhattacharya
Surjyo Bhattacharya

Posted on

Power Automate: Cloning flows in same tenant pointing to separate sources

While developing solutions in PowerApps or Power Automate we would generally be doing development in the Default (Company) environment. There might be licensing costs associated with multiple environments and hence it may be an issue in getting separate development, QA or UAT environments.

It can be thought of a scenario like having single sql-server with multiple copies of Database, one as Dev and other as QA. Similarly, in power automate we can clone a flow into multiple copies in each solution and name the flows accordingly.

Steps :

  1. Extract the Deployment package using the export option at a solution level: SolutionPackage_1_0_0_1.zip

  2. Unzip the package to local computer and the folder structure shall be as shown:

Power Automate Package

  1. Delete the folder : environmentvariabledefinitions and its contents (includes sub-folders , json files)

  2. Navigate to the Workflows folder and you shall find a pre existing JSON file , copy the JSON file and paste it in the same folder location.

Multiple JSON file copies

  1. Rename the copied file by renaming the Flow Name as well replaced the existing GUID with a new GUID (the GUID in the file name should be in Upper Case)
    You might use the following URL for GUID generation
    GUID-Generator

  2. Modify the customizations.xml file in the location: SolutionPackage_1_0_0_1\customizations.xml

We shall modify the existing Workflows section, i.e will not be copying same section twice (copying over and modifying the copied section seems to be throwing errors) , but instead updating the existing section and the places to be modified are highlighted below (follow the instructions on the CASE (upper/lower) of the GUID as mentioned in the image below) :

Modification to the JSON file

Use the lower case GUID as and where applicable and can use the following online resource for the same :

CaseConverter

  1. Next we shall modify the solution.xml at ~ \SolutionPackage_1_0_0_1\solution.xml

a. Modify the version number
1.0.0.2

b. Update the existing RootComponent , (copying over and modifying the copied section seems to be throwing errors)

Modification to the solution file

c. Remove the entries under:

  1. Create a zip file maintaining the underlying folder structure to generate the updated deployment package

  2. Import the deployment package and you shall find the clones of your flow in the solution

Multiple Clones Deployed

  1. Define separate environment variables in the solution.

  2. For each environment use the corresponding environment variables inside your flow. Disable the flows when not required or delete them as required independently.

This way we can reuse the same environment to point to separate share point locations simultaneously from the same solution.

Reference

Top comments (0)