cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

Insert multiple results/items from Collection to SharePoint list

I'm trying to insert new collection values to SharePoint list. However, I get "An error occurred on the server.". Am I missing something?

 

 

ForAll(Beneficiary_Collection,
Patch(Beneficiary,
    {
    Beneficiary_Code: Beneficiary_Code,
    Order_Number: Value(Order_Number),
    First_Name: First_Name,
    Last_Name: Last_Name,
    Gender:
    {
    '@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
    Id: LookUp( Gender_Lookup, Gender = English_Def, ID ),
    Value: LookUp( Gender_Lookup, Gender = English, English_Def )
    },
    Date_Of_Birth: Date_of_Birth
    })
)

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Insert multiple results/items from Collection to SharePoint list

Hi @Kevin_Maxwell,

 

Could you please share a bit more about the Beneficiary that you mentioned? Is it a SP list on your side?

Further, could you please share a bit more about your SP list?

 

I found that you have posted a similar issue within this forum and I have made a response to it. Please check the following thread:

https://powerusers.microsoft.com/t5/General-Discussion/How-to-loop-collection-lookup-values/m-p/1270...

 

Based on the formula that you provided, I think there is something wrong with the Patch function within your formula. I assume that the Beneficiary that you mentioned is a SP list and you want to add a new item into your SP list using Patch function, I think you have ignored the Defaults function.

 

Please take a try to modify your formula as below:

ForAll(Beneficiary_Collection,
Patch(Beneficiary,Defaults(Beneficiary),
    {
    Beneficiary_Code: Beneficiary_Code,
    Order_Number: Value(Order_Number),
    First_Name: First_Name,
    Last_Name: Last_Name,
    Gender:
    {
    '@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
    Id: LookUp( Gender_Lookup, Gender = English_Def, ID ),
    Value: LookUp( Gender_Lookup, Gender = English, English_Def )
    },
    Date_Of_Birth: Date_of_Birth
    })
)

More details about the Patch function in PowerApps, please check the following article:

Patch function

 

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Highlighted
Community Support
Community Support

Re: Insert multiple results/items from Collection to SharePoint list

Hi @Kevin_Maxwell,

 

Could you please share a bit more about the Beneficiary that you mentioned? Is it a SP list on your side?

Further, could you please share a bit more about your SP list?

 

I found that you have posted a similar issue within this forum and I have made a response to it. Please check the following thread:

https://powerusers.microsoft.com/t5/General-Discussion/How-to-loop-collection-lookup-values/m-p/1270...

 

Based on the formula that you provided, I think there is something wrong with the Patch function within your formula. I assume that the Beneficiary that you mentioned is a SP list and you want to add a new item into your SP list using Patch function, I think you have ignored the Defaults function.

 

Please take a try to modify your formula as below:

ForAll(Beneficiary_Collection,
Patch(Beneficiary,Defaults(Beneficiary),
    {
    Beneficiary_Code: Beneficiary_Code,
    Order_Number: Value(Order_Number),
    First_Name: First_Name,
    Last_Name: Last_Name,
    Gender:
    {
    '@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
    Id: LookUp( Gender_Lookup, Gender = English_Def, ID ),
    Value: LookUp( Gender_Lookup, Gender = English, English_Def )
    },
    Date_Of_Birth: Date_of_Birth
    })
)

More details about the Patch function in PowerApps, please check the following article:

Patch function

 

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,325)