cancel
Showing results for 
Search instead for 
Did you mean: 

How-to: Update multiple data sources from an edit form

A question I often receive is how to update more than one list when using an edit form.  Since the edit form is linked to one specific data source and updated when you invoke the SubmitForm function, a second update mechanism is required.  The solution lies in the use of the Patch function in conjunction with SubmitForm.

Here's an example from one of my apps to illustrate.  When an update is made to a project record, I also want to record two additional updates --  record today's date as the last update date for the department to which the project belongs and create an audit trail record to show what was updated.  

I let the EditForm handle the heavy lifting of the project record update since that's where the bulk of my updates are taking place.  To save my changes to the edit form, I have a check icon.  In the OnSelect property of this check icon, I'll handle all the updates to the data sources.  
Patchexample2.jpg

 

In addition to executing the SubmitForm(EditProject), I'll also execute two Patch statements - the first adding a new audit trail record and the second updating an existing department record.

PatchExample.jpg

 

Here's the results of the two patch functions we executed as shown in two separate administrative reports from the system - the first for the department last updated information and the second displaying the audit trail.
PatchExample3.jpg

 

So if you have more than one data source to update, use Patch in conjunction with SubmitForm to achieve your objective.

Meet Our Blog Authors
  • PowerApps Community Mentor 2018, Practicing surgeon and former Professor of Surgery, University of Illinois, Chicago.
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 12 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Systems developer
  • My name is Timothy Shaw and I create digital solutions using the Power Platform, Office 365, and Azure SQL and handle the IT for a small company in the energy sector. When not building the future :), I enjoy playing guitar, good (or really bad!) sci-fi, Xbox therapy, and hanging with my wife and son. Twitter: @ShortForTim