How To Save Records In Multiple List Using One Form And One Submit Button In PowerApps

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,
How To Save Records In Multiple List Using One Form And One Submit Button In PowerApps
  • Create a list called Employees Information with the below field,
How To Save Records In Multiple List Using One Form And One Submit Button In PowerApps
 
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,

How To Save Records In Multiple List Using One Form And One Submit Button In PowerApps
 
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, 
  1. Patch(  
  2.     'Employees Information',  
  3.     Defaults('Employees Information'),  
  4.     {  
  5.         Title: txtName.Text,  
  6.         DOB: DatePicker1.SelectedDate,  
  7.         Address: txtAddress.Text  
  8.     }  
  9. );  
  10.   
  11. Patch(  
  12.     Employees,  
  13.     Defaults(Employees),  
  14.     {Title: txtName.Text}  
  15. );  
  16.   
  17. Notify("Record Saved Successfully!!!");  
Once the Patch function is implemented we will run PowerApp.
 
Output
 
Save Records
 
Employee Records
  
Employee Info Record
 
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!!!


Similar Articles