cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AuburnMist
Helper IV
Helper IV

Patch function to update multiple forms

Hello,

 

I have an app (SP Integrated form) that is spread across multiple screens. To submit everything to my list at once and to create only one record, I've used the Patch function. 

My code is 

Patch(STARS,Defaults(STARS),'STARS Form'.Updates,'STARS Form_1'.Updates,'STARS Form_2'.Updates,'STARS Form_3'.Updates,'STARS Form_4'.Updates,'STARS Form_5'.Updates);Navigate(ThankYouScreen,ScreenTransition.Fade)

 

I need to understand how to modify the code above in order for EDITS to be patched in the same way. Currently, when a user edits their record, it creates a new record in my sharepoint list .

 

Thank you for your help!  

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Thorpe
Super User
Super User

If varRecord is the record that needs to be updated then your Patch for updating would look like this:

Patch(STARS,varRecord,'STARS Form'.Updates,'STARS Form_1'.Updates,'STARS Form_2'.Updates,'STARS Form_3'.Updates,'STARS Form_4'.Updates,'STARS Form_5'.Updates);Navigate(ThankYouScreen,ScreenTransition.Fade)

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

4 REPLIES 4
Jeff_Thorpe
Super User
Super User

The Defaults(STARS) parameter needs to be change to the record that needs to be updated. My guess is that the record is the same has what is listed the Item property of 'STARS Form'.

Example: gallery.selected



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Hello, 

 

The Items property of the Stars form (all of them) is varRecord. 

If I need to replace the "Defaults(STARS)" section of the code with the record that needs to be updated, how do I do that?

 

Drrickryp
Super User
Super User

@AuburnMist

A Patch() has 3 elements, the datasource, the record to be patched, and the values to be patched.  Defaults(datasource) is the second element and means that a new record is created.  Since you are using several forms, I suggest creating a global variable for the OnVisible property of the screen and then using 

Set(selectedLookupItem, LookUp(YourSharepointIntegrationObject, ID=SharePointIntegration.SelectedListItemID ))
So

Patch(STARS, selectedLookupItem, ...)

 

Jeff_Thorpe
Super User
Super User

If varRecord is the record that needs to be updated then your Patch for updating would look like this:

Patch(STARS,varRecord,'STARS Form'.Updates,'STARS Form_1'.Updates,'STARS Form_2'.Updates,'STARS Form_3'.Updates,'STARS Form_4'.Updates,'STARS Form_5'.Updates);Navigate(ThankYouScreen,ScreenTransition.Fade)

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,825)