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 / Patch multiple records...
Power Apps
Unanswered

Patch multiple records to single sharepoint lookup column

(0) ShareShare
ReportReport
Posted on by 4

Hi all,

 

I have two SharePoint lists. Contracts and Contract_requests. The end user of my app can initiate multiple contracts at once, which are registered in the Contracts sharepoint list as separate records. In the contract_request table I want to create one entry that has a 'Contracts_linked' column that consists of a LookUp to entries created in the Contracts SharePoint list. 

 

In order to accomplish this I use the action below to create a record for each contract (stored in the contract_dataset collection) in the Contracts Sharepoint List. Within the action I use a collect to create a MyPatchedRecords Collection to get back the records that were just created so I can use their ID in the follow up patch function. So far this is working well. 

 

ForAll(contract_datasets As A;Collect(MyPatchedRecords;Patch(contracts; Defaults(contracts);{Titel: "test2"};{department:A.department};{justification:"test"})));;

 

Now I want to use a new Patch function to create one new record in the Contract_requests SP list that links to all other records that were just created in the Contracts SP list. In order to do this I have tried multiple things

 

Patch(Contract_requests; Defaults(Contract_requests);{Contracts: Filter(Contracts; ID in MyPatchedRecords.ID)};{Titel:"test");;

 

Error: Expects table type but expects different schema

 

 

Or tried:

 

Patch(Contract_requests; Defaults(Contract_requests);{Titel:"test"};{Contracts:Filter(Contracts; ID  in Concat(MyPatchedRecords;'Id (ID)'))})

 

And I have tried many other variations using Lookup, Filter, etc. but can't make it work. Does anyone know what is going wrong here?

 

Thanks in advance!

Categories:
I have the same question (0)
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @aag ,

     

    Please try:

    Patch(
     Contract_requests; 
     Defaults(Contract_requests);
     {Titel:"test"};
     {Contracts:ForAll(Filter(Contracts; ID in Concat(MyPatchedRecords;'Id (ID)'));{Id:ID})} 
     )

     

    Best Regards,

    Bof

  • aag Profile Picture
    4 on at

    Hi Bof,

     

    Thanks for your reply. This is unfortunately not working. 

     

    I also learned that when you use the Concat it appends the IDs so is not suitable to use in a filter. E.g. let's say I created two contracts with ID 20 and 21, the result of the concat will be 2021. Hence the filter will select contracts with ID 1, 2, 20, 21, 202, 021 and 2021 instead of only 20 and 21. 

    Concat(MyPatchedRecords;'Id (ID)')

     

    Any other ideas?

     

    Thanks again.

     

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @aag ,

     

    Please try:

    Patch(
     Contract_requests; 
     Defaults(Contract_requests);
     {Titel:"test"};
     {Contracts:ForAll(MyPatchedRecords;{Id:'Id(ID)'})} 
     )

     

    Best Regards,

    Bof

  • aag Profile Picture
    4 on at

    Hi Bof,

     

    This is also not working, get the error: "Invalid argumenttype: Expects table but from different schema". This is a common error that I have ran into multiple times when trying other options using filters, patch, lookups...

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 392

#2
WarrenBelz Profile Picture

WarrenBelz 364 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 271 Super User 2026 Season 1

Last 30 days Overall leaderboard