Showing results for 
Search instead for 
Did you mean: 
Responsive Resident
Responsive Resident

Duplicating Records along with its related Records

Hi All,

I'm having a specific requirement where on a button click, need to duplicate that entity's Related record along with its related records.

Basically entity A -> entity B -> entity C.


What I have achieved so far,

On click of Record(X) of Entity A, collect data in collection of all related records (Y) in Entity B and another collection of records relating to Record(Y) in entity C.

Now I have duplicated Record(X) in Entity A and related Record(Y) to Entity B.


I'm stuck where I need to duplicate Record(Z) from entity C related to new Record(Y) from Entity B.


I'm gone through MS Docs. came across With() function which can help but I have no idea how to use. With Function 

I need to perform ForAll() into With.


Need Advice.



Responsive Resident
Responsive Resident

Hi All,

Any idea on above requirement ?

Referring to my previous post: 

You would need to do something like this. Notice the difference in the names EntityA, EntityB and EntityC. EntityAID/EntityBID is the ID of the respective patch results.

  Patch(EntityAs, Defaults(EntityAs), {Column1: "XYZ", Column2: "ABC"}),
      Patch(EntityBs, Defaults(EntityBs), {EntityA: EntityAID, Column1: EntityBGalleryColumn}),
        Patch(EntityCs, Defaults(EntityCs), {EntityB: EntityBID, Column1: EntityCGalleryColumn})

 Hope this helps!

Helpful resources

PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,421)