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.
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,
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?
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
181 | |
52 | |
41 | |
39 | |
33 |
User | Count |
---|---|
261 | |
81 | |
71 | |
69 | |
66 |