web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Duplicate an existing ...
Power Automate
Unanswered

Duplicate an existing flow inside another Automated flow

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello guys,

This post will be a little bit long, I hope you would be patient with me and excuse my poor English 

I have a SharePoint List (let's call it ListA), I create an associated flow that do some notification actions, all of this is working very well. 

Now I won't have just one list, in the future i will have "n similar lists" which they will need the same flow, I couldn't find a way to create one flow that handle everything for these all lists, so i realised I can quite simply duplicate that flow (Save as copy) then edit the list name in the flow trigger, right ?

 

since the SharePoint site will be used by a simple users (which they don't have access to Power Automate and duplicate the flow), I need to do it automatically when a new list is created !

 

so what i have done until now:

  • I get the first flow
  • I get the flow definition (which it's in JSON format), connectionReferences, status ...etc
  • I create another flow with another name, I'll use the same connectionReferences, status, while i should edit some properties in the flow definition
  • the properties i am talking about is the List ID, which it should be changed for every duplicated flow, right ?

     

Now the problem that i have encountered until now:

 

  1. How can i manage that flow definition, edit the property "path" (from the json format: "triggers→when_an_item_is_created→inputs→path") ?

Note that the value of "path" is: "/datasets/@{encodeURIComponent(encodeURIComponent('.../sites/Support'))}/tables/@{encodeURIComponent(encodeURIComponent('3939098e-a076-48e8-b020-b0df1589b327'))}/onupdateditems"

 

While I should change that ID ''3939098e-a076-48e8-b020-b0df1589b327" by another one I just got and save it in a variable

 

So I searched for a way to edit this JSON, and I found an expression named "setProperty(<object>, '<property>', <value>)" and in order to edit that "path" property, I need to use nested setProperty (please refer to this link to understand what i'm saying)

 

here is what I build:

setProperty(body('Get_Flow')['properties']['definition'],'triggers', setProperty(body('Get_Flow')['properties']['definition']['triggers'], 'When_an_item_is_created_or_modified',setProperty(body('Get_Flow')['properties']['definition']['triggers']['When_an_item_is_created_or_modified'], 'inputs',setProperty(body('Get_Flow')['properties']['definition']['triggers']['When_an_item_is_created_or_modified']['inputs'], 'path','/datasets/@{encodeURIComponent(encodeURIComponent(''.../sites/Support''))}/tables/@{encodeURIComponent(encodeURIComponent(''def533d7-8ede-4f29-b882-57d48a90c2d8''))}/onupdateditems' ))))

 

as you can see at the end of this expression, I used the two quotes ('') to use the quote inside that expression (for example, inside a concatenation expression

  • concat('client's ','request') this is false 
  • concat('client''s ','request') this is true, and the output will be (client's request)

 

So, the previous expression setProperty i mentionned above, it works fine and the new flow in created perfectly with the new name of the new list (let's call it ListB), but my desire is to replace the new ID dynamically and not like i've done so far, it should like this:

 

setProperty(body('Get_Flow')['properties']['definition'],'triggers', setProperty(body('Get_Flow')['properties']['definition']['triggers'], 'When_an_item_is_created_or_modified',setProperty(body('Get_Flow')['properties']['definition']['triggers']['When_an_item_is_created_or_modified'], 'inputs',setProperty(body('Get_Flow')['properties']['definition']['triggers']['When_an_item_is_created_or_modified']['inputs'], 'path','/datasets/@{encodeURIComponent(encodeURIComponent(''.../sites/Support''))}/tables/@{encodeURIComponent(encodeURIComponent(''def533d7-8ede-4f29-b882-57d48a90c2d8''))}/onupdateditems' ))))

 

and this will replace put the text exactly as it is "variables('ID')",  while it should replace the value of this variable !

 

Thank you.

 

 

 

 

 

 

Categories:
I have the same question (0)
  • Gristy Profile Picture
    2,429 on at

    check out wonder laura's blog for some tips on this it is what got me to a working solution, but you are right it is not pretty.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard