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

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 ?
Screenshot 2024-07-26 115540.png
Categories:
I have the same question (0)
  • Suggested answer
    MichaelFP Profile Picture
    2,001 Moderator 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

#2
11manish Profile Picture

11manish 193

#3
Valantis Profile Picture

Valantis 138

Last 30 days Overall leaderboard