cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bhitchlockfcs
Resolver II
Resolver II

Copy/Duplicate a Flow in a Solution

I have a Flow in an existing solution for which I need to create several variants. Ideally I would copy the flow and edit the copy. 

Unfortunately the copies are created outside the solution and are not visible to import into the solution.

Any ideas on how to replicate a Flow inside of a Solution?

 

Thanks,

 

Brian

34 REPLIES 34
rvroman
Frequent Visitor

After following the above (thanks @abm ), upon import, I get an error: 

 

The solution file is invalid. The compressed file must contain the following files at its root: solution.xml, customizations.xml, and [Content_Types].xml. Customization files exported from previous versions of Microsoft Dynamics 365 are not supported.

 

Could this be due to the editor I used to edit the customizations.xml file? Other ideas?

 

@Welbywelb , I'm absolutely new to Postman and a lot of web-tinkering, but I followed your recommended steps and think I found what was needed, but the response I received was:

 

{
    "error": {
        "code""UnsupportedMediaType",
        "message""Unsupported media type."
    }
}
 
The flow does have child flows, not sure if that's the "unsupported media type", of if there are other ideas.
kat_rock
Frequent Visitor

Amazing work @Welbywelb and @zolle04
These instructions and screenshots made something that seems overwhelming at first really easy. Thank you so much!

@rvroman I know this is an old post, but if it helps I had the same error which resolved by selecting 'raw' and 'JSON' for the body

kat_rock
Frequent Visitor

Hi everyone
Here are the individual steps of @Welbywelb solution using Postman:

1. Within the solution, create a new flow with a few basic steps and save it. This is your target flow which will be over-written with the flow you are going to duplicate. Take note of the name because you will need it at Step 9.

2. Open the inspect window for the TARGET flow and navigate to the "network" tab. Click 'Save' on the flow and capture the PATCH post URL and Bearer token.

3. Go to the flow you want to copy (your SOURCE flow) and in Chrome open the inspect window and navigate to the "network" tab.

4. Click 'Save' on the flow and capture the body of the Patch command (Payload > Request Payload > View Source > Show More. (Starts with {"properties":..)

5. Go to Postman (https://www.postman.com/) and create a new Patch request.

6. Add the URL from Step 2

7. Select the Authorization tab and select 'Bearer token'. Add the Bearer token from Step 2

8. Paste the body of the flow you want to copy from step 4 and select ‘raw’ and JSON.

9. Edit the "displayName" in the body so it matches exactly what you called the target flow.

10. Hit Send and the target Flow should be updated with the contents of the flow you just copied.

Welbywelb
Advocate III
Advocate III

Thank you kat_rock - yeah sorry I had missed the raw/JSON selection in Body type when I wrote that up. Still cannot believe this functionality is not available natively 😞

Thanks a lot for that.

 

First of all, thanks for that... it's unbelievable that we need to do this to copy a flow to the solution...

 

One thing I believe is also worth mentioning is that you need to increase the version on 'solution.xml' if you intend to import the solution back to the same environment.

russoedu_0-1658849402753.png

 

 

LRA-Admin
Frequent Visitor

I didn't pay attention to the words "source" and "target" in the solution using Postman, and ended up overwriting and renaming my original flow!

 

Highlighting these in kat_rocks version:

 

2. Open the inspect window for the TARGET flow and navigate to the "network" tab. Click 'Save' on the flow and capture the PATCH post URL and Bearer token.

3. Open the flow you want to copy (your SOURCE flow) and in Chrome open the inspect window and navigate to the "network" tab.

4. Click 'Save' on the flow and capture the body of the Patch command (Payload > Request Payload > View Source > Show More. (Starts with {"properties":..)

...etc

 

 

seems a bit complicated. Should the clone button not do this?

tpratt
Regular Visitor

Received the follow error on import:

The solution file is invalid. The compressed file must contain the following files at its root: solution.xml, customizations.xml, and [Content_Types].xml. Customization files exported from previous versions of Microsoft Dynamics 365 are not supported.

Good idea! I've made the same updates to my post for clarity. 

Thanks @abm

 

following your guideline I’ve developed an utility zx-powerapps-cli hope this could help

TschoofBAH
Advocate III
Advocate III

Great work from some folks to solve this issue that should absolutely NOT be an issue in this system.

 

This is why adoption of PowerPlatform is so difficult, a functionality that should just WORK doesn't and you find this all over the place within Power Platform. 

NickTLS
Frequent Visitor

The need to do this is asinine.

 

I want to make a change to a child flow in a new direction. Figured I could just clone the workflow, give it a new name and then re-import. Figured it would be a two second fix. Instead, I have spent hours to stumble on this thread. What is even more infuriating is that sometimes the clone and import just work! I have another workflow in a solution that I cloned multiple time to point to different document libraries for testing and all but 1 wont import back into the solution. The only thing that is different is the document library the workflow is looking at on the same site.

+1 vote for @zolle04  solution.
@bhitchlockfcs Any chance of marking @zolle04  as a solution as well, to help someone else navigating these threads.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (2,861)