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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Duplicating Records al...
Power Apps
Unanswered

Duplicating Records along with its related Records

(0) ShareShare
ReportReport
Posted on by 4,838 Moderator

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.

Thanks 

 

I have the same question (0)
  • Ethan_009 Profile Picture
    4,838 Moderator on at

    Hi All,

    Any idea on above requirement ?

  • EricRegnier Profile Picture
    8,720 Most Valuable Professional on at

    Referring to my previous post: https://powerusers.microsoft.com/t5/Microsoft-Dataverse/Duplicating-Records-along-with-its-related-Records/m-p/948816#M11896 

    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.

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

     Hope this helps!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard