cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
romankorchak1
Helper I
Helper I

Copy SharePoint list item to another list

Hi All

I need to copy a SharePoint list item from one SP List to another (identical) SP list

So I am trying is 

 

UpdateContext({Item:LookUp(TestList1,ID=2)});
Patch(TestList2, Defaults(TestList2), Item);

But getting error  "Field 'Id' is required"
What, I think, might be happening, is created record (Item) got Id, which is created by system when adding new list item, and it cannot be changed. If thats a case - how do I remove Id value from Item record?

Thanks

8 REPLIES 8
timl
Super User III
Super User III

Hi @romankorchak1 

You could try dropping the ID with a call to the DropColumns function

https://docs.microsoft.com/en-gb/powerapps/maker/canvas-apps/functions/function-table-shaping

 

UpdateContext({Item:
               DropColumns(
                  Table(LookUp(TestList1,ID=2)), "ID"
               )
              }
);
Patch(TestList2, Defaults(TestList2), Item);

 

Getting "Invalid argument type (Table). Expecting a Record value instead" . 

Also tried using "First(Item)" - then getting "{Attachments}:Field 'Id' is required" error

Drrickryp
Super User II
Super User II

@romankorchak1 

This may be a stupid question but what do you need two identical lists for?

Keeping current and archived stuff separate. 

Drrickryp
Super User II
Super User II

@romankorchak1 

I have a similar issue in my practice.  I just added a single line of text and called the column Active.  In my apps, I filter the same list on that column to separate out the Active patients from the Inactive ones. 

timl
Super User III
Super User III

@romankorchak1 

I think I see my mistake - can you try this?

UpdateContext({Item:
               First(DropColumns(
                  Table(LookUp(TestList1,ID=2)), "ID"
               ))
              }
);
Patch(TestList2, Defaults(TestList2), Item);

Tried it with "First()" - getting "{Attachments}:Field 'Id' is required" error

Helpful resources

Announcements
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 (1,004)