PowerApps update two SharePoint lists
I am trying to create a priority queue system for a PowerApp I am developing. The priority queue (RequestPriorityQueue) is stored in a SharePoint list with the following columns: Title, UniqueID, and Priority. Title is a GUID representing the queue item, UniqueID is a short identifier for the queue item, and Priority is a number, with 1 being top priority. There is also a separate SharePoint list (RequestsList) with the same columns, plus a number of other columns representing data associated with the queue item. Show What I am trying to do is patch both these SharePoint lists with the same collection which represents the priorities changing due to a queue item moving up or down in priority (which pushes all queue items above/below it down/up the queue). However, this doesn't seem to work - whenever I patch the priority list, it adds new items to the list, instead of updating the list items with the same Title/UniqueID - what am I doing wrong? If(!(ThisItem.Priority = PriorityDropdown.Selected.Value), ClearCollect(PrioritiesToChange, {Title: "init", UniqueID0: Blank(), Priority: -1}); ForAll(ShowColumns(RequestPriorityQueue, "Title", "UniqueID0", "Priority"), Collect(PrioritiesToChange, {Title: Title, UniqueID0: UniqueID0, Priority: Priority})); If(ThisItem.Priority > PriorityDropdown.Selected.Value, ClearCollect(PrioritiesToChange, Filter(PrioritiesToChange, Priority >= PriorityDropdown.Selected.Value && Priority < ThisItem.Priority)); UpdateIf(PrioritiesToChange, true, {Priority: Priority + 1}); UpdateIf(PrioritiesToChange, Title = ThisItem.Title, {Priority: PriorityDropdown.Selected.Value});, ClearCollect(PrioritiesToChange, Filter(RequestPriorityQueue, Priority <= PriorityDropdown.Selected.Value && Priority > ThisItem.Priority)); UpdateIf(PrioritiesToChange, true, {Priority: Priority - 1}); UpdateIf(PrioritiesToChange, Title = ThisItem.Title, {Priority: PriorityDropdown.Selected.Value}); ); RemoveIf(PrioritiesToChange, Title = "init"); Patch(RequestPriorityQueue, PrioritiesToChange); Patch(RequestsList, PrioritiesToChange); Refresh(RequestsList); Notify("Priority changed"); );
In this PowerApps Tutorial, we will discuss how to Submit data to two SharePoint Lists in PowerApps. We will see how to use the PowerApps Patch function to submit data to multiple lists. Complete SharePoint Training Course Bundle Just for $199 How to submit data to two SharePoint lists in PowerApps? In PowerApps, we can insert data to multiple lists by using Patch function. By taking a simple scenario, we will see how to add records in two different SharePoint Lists in a PowerApps App. In PowerApps we can connect two sharepoint lists. Most of the people may think that, Can we save the items in two or multiple SharePoint Lists using Powerapps? The answer is, Yes, We can easily insert and save multiple records to multiple SharePoint Lists using the Powerapps Patch Function and a Powerapps Button. First of all, I have created two SharePoint Lists in my SharePoint Online Site named as:
The Project Details list is having these below columns with different Data types as:
And, the Client Project Details list is having with these below columns as:
As per my requirement, I will enter all these field values in the Powerapps itself. And, when I will save all the field values, then those values will store in both of the SharePoint Lists (Project Details and Client Project Details). Follow these below things to do so:
Where,
5. Similarly, there is another Choice field named “Employee Job“. For that, take one Radio button control (Insert -> Input -> Radio). Rename it to rdEmployeeJob. Select the Radio control and apply the below formula on its Items property as: Items = Choices([@'Project Details'].'Employee Job')Where.
6. Add a Button (Insert -> Button) and rename it to btnSaveRecords. Select the Button and set its Text property as “Save Data to Multiple SharePoint List”. 7. Select the Button and apply this below formula on its OnSelect property as: Where,
You can refer the below screenshot: The whole Powerapps screen structure, you can see in the below screenshot: Next, Preview (F5) the Powerapps app and enter all the field records. Click on the button (Save Data to Multiple SharePoint List) as shown below: Now go to the SharePoint List (Project List), you can see the record values has been already added as like below screenshot. Similarly, go to another SharePoint List (Client Project Details), there also the record value has been added as shown below. Here is an update from Ibrahim Ersoy regarding the Patch function in PowerApps. Hi Bijay, Also, you may like these below Powerapps Tutorials: In this Powerapps Tutorial, We learned how to insert items to multiple SharePoint lists using Powerapps. Basically, we got to know the below things:
I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site EnjoySharePoint.com |