How to: Duplicate a solution-aware Power Automate Flow

The way you can duplicate a flow inside a Power Platform solution, vividly reminds me of the Infopath forms days. You then had to download the package, rename to cab, edit the files, make a new cab and upload to your destination. The process to duplicate a flow in a solution is very similar.

What is the problem:

When a flow is not inside a solution, you can click on the kebab menu and select the “Save as” option to create a copy of that flow in place.

image

Unfortunately, that option does not exist in the case of solution-aware flows.

image

What is the solution

Unfortunately, there is no user-friendly, straightforward way to duplicate a solution-aware Power Automate flow. However, the following does work and it’s a lot less convoluted than it looks at first:

  1. Export the entire solution and download the compressed file
  2. Extract the files from the compressed file
  3. There will be a Workflows folder as a result of the decompression. Click to enter the Workflows folder
  4. There will be a JSON file for each of the flows that are part of the solution. Locate the file that is associated with the flow you wish to duplicate and make a copy of it in the same folder. Then, rename the file and replace the GUID at the end with a new GUID. If you have PowerToys on your computer, use the PowerToys Run to create a new GUID (type in #guid). Otherwise, you can use an online generator such as https://guidgenerator.com.
  5. Once you’ve created the copy and renamed it with a new GUID, exit the folder and open the solution.xml and customisations.xml files.
  6. In the solutions.xml file, locate the <RootComponents> section towards the bottom of the file. There will be an entry for each of the flows that make up the solution. Make a copy of an entry just before the closing </RootComponents> and replace the ID with the GUID you created earlier. Save and close the file.
  7. In the customizations.xml file, locate the <Workflows> section. There will be a <Workflow> section right under it. It will be about 24 rows long and it will end with a closing </Workflow>. Make a copy of the entire thing, including the opening <Workflow> and closing </Workflow> tags. Make sure you paste the lines before the closing <Workflows>.
  8. In the lines you just copied, there will be two rows whose value you will want to change. In the opening <Workflow> tag, change the WorkflowId to the GUID you created earlier. Also, rename the clone of the original flow by changing the name on the same row. In the following row, where it says <JsonFileName>, replace the GUID with the one you created earlier.
  9. Save the file and close it.
  10. Back to the folder with all the files, select them (all the files and the Workflows folder) and compress them to a ZIP file. Make sure that you do not compress them inside a folder, since the XML files need to be at the root of the zip file
  11. Go back to your Power Platform Solutions and delete the existing solution that you exported earlier. If you haven’t kept a copy of the original ZIP file that you exported, now would be a good time to export again, for backup reasons.
  12. Once the original solution has been deleted, click to import the ZIP file you created. It will take a few moments. If your original solutions was unamanaged, you will have seen a message that alerted you about the contents of the solution. These are only deleted as part of a managed solution deletion. This means that when you try to import the new ZIP file, you will get a warning telling you that the original workflow has been disabled and replaced by the one in the solution you just imported.

This concludes the process. It does look overly complex and scary, but it really isn’t anything difficult to accomplish.

Update

It appears that this was the old way of doing things. Since April 28, you can click on a solution aware flow (either from inside the solution or from the “flows” area and use the “Save as” button as you would for any non-solution-aware flow. That’s good to know, although a bit confusing that if you select a solution-aware flow inside a solution (i.e. not click through to open the flow) you do not get any option to “save as” or even “export” the flow.

References

  1. MS Power Automate Community: Copy/Duplicate Flow in a Solution.
MGR: the Intelogist

About MGR: the Intelogist

SharePoint Server developer, turned Sitefinity developer, turned Angular developer, turned SharePoint Online consultant, turned Unily consultant, turned O365 consultant... Never a dull moment!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

This site uses Akismet to reduce spam. Learn how your comment data is processed.