Introduction
Sometimes we need to save records in multiple lists in SharePoint using one submit button in one form. For example, we want to manage multiple lists for employees in an organization for different operations in different lists. so for this, we will create one form with some controls and save records in the multiple SharePoint lists.
In this article, we will see how to save records in multiple lists in PowerApps using patch function.
Scenario
Here we will create two SharePoint lists for Employees and Employee Information. Then we will create a PowerApps and will add some controls and then will use patch function to save records in multiple SharePoint lists. Here we are using two lists but we can also use more than two lists as per our requirement.
Demo
Let's start step by step implementation as below:
Create SharePoint lists as below:
- Create a list called Employees with the below field,
- Create a list called Employees Information with the below field,
Let's start the PowerApps Implementation step by step,
- Move to the PowerApps
- Go to the Create > Canvas app from blank
- Give App name and select format
Now we will add the required controls (Labels, Dropdowns, and button) in our PowerApps as shown below,
Add the required Data sources as below,
- Go to the View on top ribbon > Select Data source > Search SharePoint > Add connection > Connect to the SharePoint Site > Select lists (Employees and Employees Information).
In this example, our requirement is saving records in multiple lists so we have to use two patch functions as we are saving records in Employees and Employees Information lists.
Select Submit button > Onselect property we will use Patch function as below,
- Patch(
- 'Employees Information',
- Defaults('Employees Information'),
- {
- Title: txtName.Text,
- DOB: DatePicker1.SelectedDate,
- Address: txtAddress.Text
- }
- );
-
- Patch(
- Employees,
- Defaults(Employees),
- {Title: txtName.Text}
- );
-
- Notify("Record Saved Successfully!!!");
Once the Patch function is implemented we will run PowerApp.
Output
In the above images, we can see records added in the Employees and Employees Information list.
Summary
In this article, we have seen step by step implementation of how to save records in multiple lists.
I hope you like this article and share it with others. Give your valuable feedback and suggestions in the comments section below.
Sharing is caring!!!