cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AuburnMist
Resolver I
Resolver I

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
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,281)