Update Multiple Sharepoint Lists With One Click Using Microsoft PowerApps

Introduction

 
In this article, I bring up a solution to when you want to merge multiple SharePoint lists. Rather, you can create a screen in Microsoft PowerApps, add all the fields of the SharePoint List, and use the Patch Function to update it.
 
Syntax
 
Modify or create a record in a data source
 
Patch( DataSource, BaseRecord, ChangeRecord1 [, ChangeRecord2, … ])
  • DataSource – Required. The data source that contains the record that you want to modify or will contain the record that you want to create.
  • BaseRecord – Required. The record to modify or create. If the record came from a data source, the record is found and modified. If the result of Defaults is used, a record is created.
  • ChangeRecord(s) – Required. One or more records that contain properties to modify in the BaseRecord. Change records are processed in order from the beginning of the argument list to the end, with later property values overriding earlier ones.

Instance 1

 
For this, I have created four SharePoint Lists 1. List1, 2.List2, 3. List3, 4. List4 and added some text inputs fields and purpose are on one Input Screen User will give input for all four Share Point lists and it will save and update the value in all four records. 
 
Create 4 different lists in Sharepoint: 
  1. List1
  2. List2
  3. List3
  4. List4
Create columns in the above SharePoint List with the following names:
  • In List1 create Columns 1a, 1b, 1c
  • In List2 create Columns 2a, 2b, 2c
  • In List3 create Columns 3a, 3b, 3c
  • In List4 create Columns 4a, 4b, 4c
Challenge
 
 "Update these four records simultaneously using one button click"
 
Refer my article to create the Share Point List and to create columns in a Share Point List
 
Solution
 
Login with Office 365 your ID and open the Microsoft PowerApps using the following link.
 
Update Multiple Sharepoint List With One Click Using Microsoft PowerApps
 
Choose Tablet layout:
 
Update Multiple Sharepoint List With One Click Using Microsoft PowerApps
 
Choose a Canvas app to start to design an app from scratch.
 

Adding the Data Source

 
From the top pane of the Microsoft, PowerApps screen click on View and then Data Sources, search for the Share Point list name 
 
Update Multiple Sharepoint List With One Click Using Microsoft PowerApps
 
Then add the corresponding Data Sources: 
 
Update Multiple Sharepoint List With One Click Using Microsoft PowerApps
 
Building the Screen:
 
Update Multiple Sharepoint List With One Click Using Microsoft PowerApps
 
Design and build the screen in this manner in PowerApps.
 
Insert Labels and rename them to add their Text property. 
 
1a, 1b,1c for List1
2a,2b,2c for List2
3a,3b,3c for List3 
4a,4b,4c for List4
 
Insert TextBox next to the above Labels for their corresponding Input rename the Textbox with their relative names.
 
Update Multiple Sharepoint List With One Click Using Microsoft PowerApps
 
Now add any type of different inputs in the TextInput fields and click on Submit.
 
On click function of Submit Code: 
  1. Patch(List1, Defaults(List1), {  
  2.     Title: Now(),  
  3.     '1a''1a'.Text,  
  4.     '1b''1b'.Text,  
  5.     '1c''1c'.Text  
  6. });  
  7. Patch(List2, Defaults(List2), {  
  8.     Title: Now(),  
  9.     '2a''2a'.Text,  
  10.     '2b''2b'.Text,  
  11.     '2c''2c'.Text  
  12. });  
  13. Patch(List3, Defaults(List3), {  
  14.     Title: Now(),  
  15.     '3a''3a'.Text,  
  16.     '3b''3b'.Text,  
  17.     '3c''3c'.Text  
  18. });  
  19. Patch(List4, Defaults(List4), {  
  20.     Title: Now(),  
  21.     '4a''4a'.Text,  
  22.     '4b''4b'.Text,  
  23.     '4c''4c'.Text  
  24. });  
Now() is coded for when the user gives input.
 
When the user clicks Submit, all 4 records data will be updated at the same time.
 
Output
 
List1
 
Update Multiple Sharepoint List With One Click Using Microsoft PowerApps
 
List2
 
Update Multiple Sharepoint List With One Click Using Microsoft PowerApps
 
List3
 
Update Multiple Sharepoint List With One Click Using Microsoft PowerApps
 
List4
 
Update Multiple Sharepoint List With One Click Using Microsoft PowerApps
 
The above images show the records of 4 Lists which are updated at the same time.
 

Instance 2

 
Let's take another example using Patch Function. On one PowerApps screen, we can insert multiple forms 
 
Step 1
 
On the top pane of the Microsoft PowerApps Screen, click on Insert and then Forms
 
Update Multiple Sharepoint List With One Click Using Microsoft PowerApps
 
Click on Forms
 
Update Multiple Sharepoint List With One Click Using Microsoft PowerApps
 
Add the Data source from the right pane:
 
Update Multiple Sharepoint List With One Click Using Microsoft PowerApps
 
Now add three forms in a single screen and arrange them in order:
 
Update Multiple Sharepoint List With One Click Using Microsoft PowerApps
 
Add the code in the Submit Button to update the three forms simultaneously:
  1. Patch('Registration Form', Defaults('Registration Form'), Form1.Updates);  
  2. Patch(Address, Defaults(Address), Form3.Updates);  
  3. Patch('Project Details', Defaults('Project Details'), Form4.Updates)  
Then play the app from the top right corner of the screen. 
 
Output
 
The Forms will be updated at the same time
 

Conclusion

 
Merging of Share Point List is possible using one screen on Microsoft power apps and saving data using the Patch Function.
 
In this article, we learned about using the Patch function to update multiple records, along with arranging multiple Sharepoint Lists on one screen in different Forms. 
 
Enjoy working with me! Thank you! 


Similar Articles