cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NigelP
Kudo Kingpin
Kudo Kingpin

Difference Between SubmitForm and Patch

Hi

 

If you look at the various Sample Apps, they seem to be evenly split between using SubmitForm to update the datasource and Patch to update a DataSource.

 

So what is the difference between SubmitForm and Patch and under what circumstances should you use either ?

 

Just to confuse people even more, there is then the Update (and UpdateIf) command.  When should that be used over the SubmitFormn and the Patch command.

 

Thanks

 

Nigel

2 ACCEPTED SOLUTIONS

Accepted Solutions
LanceDelano
Power Apps
Power Apps

The documentation has a good discussion about Patch - generally used for more complex updates.   When you need more control.

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

 

Submit form is used to update the contents of an edit form in a straight forward way. 

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-form

 

View solution in original post

PaulD1
Super User
Super User

Hi @NigelP 

 

I did some testing/investigation on whether there were any performance differences - you can see it here: https://youtu.be/LKcuPI0dxEg 

 

Having made a few apps now, I tend to use Patch more than SubmitForm. It is more flexible and to me, it is simply clearer what is going on and gives that little bit more control.

View solution in original post

3 REPLIES 3
LanceDelano
Power Apps
Power Apps

The documentation has a good discussion about Patch - generally used for more complex updates.   When you need more control.

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

 

Submit form is used to update the contents of an edit form in a straight forward way. 

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-form

 

View solution in original post

PaulD1
Super User
Super User

Hi @NigelP 

 

I did some testing/investigation on whether there were any performance differences - you can see it here: https://youtu.be/LKcuPI0dxEg 

 

Having made a few apps now, I tend to use Patch more than SubmitForm. It is more flexible and to me, it is simply clearer what is going on and gives that little bit more control.

View solution in original post

PoojaG
Helper I
Helper I

I have a similar questions. Earlier I was using Submit form to submit multiple forms to one data source. I realized, the best way is to use Patch() if using multiple screens for one data source.

Patch(
    'DataSource',
    Defaults('DataSource'),
    Form3.Updates,
    Form3_1.Updates,
    Form3_2.Updates
);
Notify("Form submitted successfully");

This works beautifully by storing just one record in the datasource table. But it breaks my other functionality. I had another form, which would use a different data source but should have a lookup of ID same with previous forms. The formula used was below:

ForAll(
    ColSelectedReq,
    Patch(
        'User Data Element',
        Defaults('User Data Element'),
        {'Unique ID': Form3_2.LastSubmit.ID},
        {'Data Element': Text('Data Elements')}
    )
)

 

This basically, creates a collection and save the records of a form for another SharePoint list, but also reference the unique ID generated from the previous forms. This was working with the Submit(form) button but stopped working after I used the patch function. 

Can someone please help?

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (21,409)