Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building 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 ?
Categories:
  • Suggested answer
    dmb Profile Picture
    12 on at
    How do I create a copy of a record from an Editform
    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'}
    )  
  • Suggested answer
    MichaelFP Profile Picture
    1,831 Super User 2025 Season 1 on at
    How do I create a copy of a record from an Editform
    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

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,695 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard