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
Community Champion
Community Champion

@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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,175)