cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kat_YESPrep
Frequent Visitor

Exporting Powerapps Collection to SharePoint List

I have built a Power App for ordering supplies, complete with a shopping cart. I also have a Flow that will trigger an Approval process any time new items are added to a SharePoint list.

 

OnSelect of the Submit Order button, I would like my Collection to be sent to my SharePoint list, with each row of the Collection corresponding to a row of the SharePoint list.

 

I've looked into the Patch function, but I'm not sure that's right, as I'm not using my Collection data to UPDATE the SharePoint list. I want to essentially export my Collection from Power Apps as new rows in the SharePoint list. The Approval flow will take care of everything from there.

 

Does anyone know how to do this? I've seen something like //send all rows to SharePoint list, but I didn't see how to separate the green function text from the details on my SharePoint list and Collection.

4 REPLIES 4
poweractivate
Super User II
Super User II

@Kat_YESPrep 

 

Instead of Patch, use Collect - this will add new rows.

 

 

v-yutliu-msft
Community Support
Community Support

Hi @Kat_YESPrep ,

Do you want to update multiple records by using the data in the collection?

Could you tell me the data type in collection and list?

I assume that they are all text type, try this:

1)If you want to create new records:

ForAll(collectionname,Patch(listname,Defaults(listname),{field1 in list:field1name in collection,field2 in list:field2name in collection,.....}))

If you have fields with the same fieldname in collection and list,you need to use table[@field] to avoid Ambiguity.

For example:

ID:collectionname[@ID]

2)If you want to edit existing records:

Firstly, save the records that you want to update as a collection.

ClearCollect(collectionname,Filter(listname,....))

Fill in data in the collection that you want.

Then use the unique field in collection to recognize which record to update.

Try this:

ForAll(collectionname,Patch(listname,LookUp(listname,ID=collectionname[@ID]),{field1 in list:field1name in collection,field2 in list:field2name in collection,.....}))

 

 

Please note that if you have any complex data type, you need to make a little change in your formula.

Here's a blog about this for your reference:

https://powerapps.microsoft.com/en-us/blog/bulk-update-using-forall-and-patch/

 

 

Best regards,

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

@v-yutliu-msft ,

 

I have entered the formula as specified, and it appears to work when I demo the app, but the data never appears on the SharePoint list. It looks a lot like the data you suggested in the blog post, but I did need to use the [@ID] option. But I still don't see the rows of data from the collection appear as rows of data in the SharePoint list.

 

Please let me know if you see what's going wrong in my formula:

 

ForAll(ShoppingCart,Patch(ApprovedCampusAcademicsOrders,LookUp(ApprovedCampusAcademicsOrders,ID=ApprovedCampusAcademicsOrders[@ID]),{Title:Item,ItemQuantity:OrderQuantity,Campus:campus.Value,RequesterName:Name,RequesterEmail:email,ApproverEmail:MgrEmail})); Navigate(Ordersubmitted,ScreenTransition.Fade)

I'm not sure what you mean. Collect from a collection into a SharePoint list? What does this formula look like?

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,478)