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 / How do I create a copy...
Power Apps
Unanswered

How do I create a copy of a record from an Editform

(1) ShareShare
ReportReport
Posted on by 31
Hi All, 
 
I have an App to create Permits for my Organisation, linked to a SharePoint List. As you can see in the image attached all the saved forms created are shown in a DataTable. I've created a Button(Copy Item) to duplicate the selected item in the DataTable. But The code I used dosent work just produce a blank record in my SharePoint list. Does anyone know what I should do ?
Categories:
I have the same question (0)
  • Suggested answer
    MichaelFP Profile Picture
    1,847 Super User 2025 Season 2 on at
    try to using the patch like this
     
    Patch('Permit App List', Defaults('Permit App List'),{});
    
    inside the brackets you put the fields that you want to created the record.

    In the way that you trying to do it, you are merging data and after setting only the data with ID as Blank(), generating a blank data.
     

    Please read the documentation for more details; Patch function - Power Platform | Microsoft Learn
  • Suggested answer
    dmb Profile Picture
    12 on at
    Use Patch, although Collect should also work if you don't need to handle subsequent patching of the created record and image columns.
    Remove the system columns that will fail the operation. For Dataverse those columns are:
    - GUID and CreatedOn as they are generated by the platform and invalid upon create;
    - Status and Status Reason in case your gallery is not filtered to show only Active records. Records in Dataverse cannot be created in Inactive state so you will need to send those in another update request. The Patch function returns the created/modified record, so we will use it to patch it. 
    For SharePoint, you should check "invalid for create" columns by yourself.
    The Table and DropColumns expressions below are used just to remove the properties from the selected record object. Making those fields 'null' (with Blank expression) won't work as it is not the same as making them 'undefined'.
     
    Patch(
        <YourTable>,
        Patch(
            <YourTable>,
            First(
                DropColumns(
                    Table(Gallery1.Selected),
                    <YourTableGuidColumn>, 'Created On', Status, 'Status Reason'
                )
            )
        ),
        {Status: Gallery1.Selected.Status, 'Status Reason': Gallery1.Selected.'Status Reason'}
    )  

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard