PowerApps connect multiple SharePoint lists

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:

  1. Project Details
  2. Client Project Details

The Project Details list is having these below columns with different Data types as:

  • Title [By default, it is a Single Line of Text]
  • Employee First Name [Single Line of Text]
  • Employee Last Name [Single Line of Text]
  • Employee Job [Choice]
  • Client Project [Single Line of Text]
  • Client [Choice]

And, the Client Project Details list is having with these below columns as:

  • Title [By default, it is a Single Line of Text]
  • Manager [Single Line of Text]

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:

  • Sign in the PowerApps app with your credentials.
  • Create a new Blank Canvas app and choose any one Layout either Tablet or Phone. Then a Powerapps blank screen will appear.
  • First of all, Connect the SharePoint Data Source with Powerapps app [View -> Data sources -> Connectors -> SharePoint -> Add a new or existing connection].
  • Choose the specific SharePoint Site and select both the SharePoint Lists [Project Details and Client Project Details] and hit on the Connect button. Now the SharePoint lists are connecting to the Powerapps app.
  • On the Powerapps Blank screen, Insert these below input controls as:
  1. Add eight Labels [Insert -> Label]. As I have a total of eight numbers of Columns in both of the SharePoint Lists [Project Details and Client Project Details], that’s why I have taken eight labels and also renamed.
  2. Insert six Text input controls [Insert -> Input -> Text input] and rename it if you want. As in both of the SharePoint lists, there are six numbers of a single line of text columns. The Default property of all Text inputs should be blank value i.e. [Default = ” “]
  3. As the Project Details list is having a Choice column named “Client“, So for that, add one Dropdown control [Insert -> Input -> Dropdown]. Rename the Dropdown control to ddClient.
  4. Select the Dropdown control and apply the below formula on its Items property as:
Items = Choices[[@'Project Details'].Client]

Where,

  • ‘Project Details’ = SharePoint List name
  • Client = Choice column

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.

  • ‘Employee Job’ = Choice field from the Project Details list

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:

OnSelect = Patch[ 'Project Details', Defaults['Project Details'], { Title: txtProjectTitle.Text, 'Employee First Name': txtEmployeeFirstName.Text, 'Employee Last Name': txtEmployeeLastName.Text, 'Client Project': txtClientProject.Text, Client: ddClient.Selected, 'Employee Job': rdEmployeeJob.Selected } ]; Patch[ 'Client Project Details', Defaults['Client Project Details']; { Title: txtClientProjectTitle.Text, Manager: txtManager.Text } ];

Where,

  • Patch = This function helps you to update the record in the Data source
  • ‘Project Details’ = SharePoint List Name where the inputs will store
  • Defaults[‘Project Details’] = This Default function helps you to create a new record in the Project Details list
  • txtProjectTitle.Text = Project Title input text control name
  • txtEmployeeFirstName.Text = Employee First Name text input control name
  • txtEmployeeLastName.Text = Employee Last Name text input control name
  • txtClientProject.Text = Client Project text input control name
  • ddClient.Selected = Client Dropdown control name
  • rdEmployeeJob.Selected = Employee Job Radio button control name
  • ‘Client Project Details’ = SharePoint List name where the inputs will store
  • Defaults[‘Client Project Details’] = Default function helps you to create a new record in the Client Project Details list
  • txtClientProjectTitle.Text = Project Title text input control name
  • txtManager.Text = Manager text input control name

You can refer the below screenshot:

powerapps patch sharepoint list

The whole Powerapps screen structure, you can see in the below screenshot:

powerapps connect two sharepoint lists example

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,
First of all, thanks for writing such a nice post. I would like to share my experience using Patch updates in PA. We worked with a customer that requires an app. We built the app, published it, and went on the testing stage. While the app was working fine with a couple of user accounts, it wasn’t working for a serious number of accounts. Later we found that using Patch for inserting data was causing the problem due to a limit of usage in the SharePoint and Power Platform. We made a mistake for using Patch for insert/update operations but later quickly converted them into Power Automate workflows and everything worked greatly from this point. I would never ever advise using Patch[] for insert/update as 1 Patch function wouldn’t be a problem mostly but 2 or more Patch will be problematic for the developer. Data operations should be handled via Power Automate or through Forms controls but not Patch.

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:

  • PowerApps: Submit data to two SharePoint Lists
  • powerapps multiple sharepoint lists
  • powerapps connect two sharepoint lists
  • powerapps join two data sources
  • powerapps patch sharepoint list

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

Video liên quan

Chủ Đề