cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kevin_Maxwell
Level: Powered On

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
Community Support Team
Community Support Team

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
Community Support Team
Community Support Team

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,566)