cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MichaelSmith
Level: Powered On

Re: Save data from multiple screens to submit

Hi All - I'm also looking to create new entries on a Sharepoint list - using a Form in PowerApps.   The thing I found that did not work with the Patch - was the OnSuccess or OnFailure - Navigate to   function. 

 

Right now I'm Patching Data from a Form2. and Form3.. where some of that data is 'Required Data'.  If the required info is not inputed, the form Fails and I would like it to Navigate tot  screen that says 'Your form has failed'. 

 

this is my current script

Patch('Pre-Trade-Approval', Defaults('Pre-Trade-Approval'), Form2.Updates, Form3.Updates) 

 

Any thoughts on how to invoke the OnSuccess or OnFailure function with Patch?  or vice-versa... can i use  SubmitForm for Form2 and Form3 data (which are both on sepearte screens. 

 

Meneghino
Level 10

Re: Save data from multiple screens to submit

@MichaelSmith

If you use a Patch, you do not really need an OnSuccess.

Basically you either store the result of the Patch is a variable and then inspect the variable to determine success or falure, or you check the Errors() function to see if the result is empty or both.

 

Here is a simple pseudo-code example:

Set(PatchReturnRecord, Patch('Pre-Trade-Approval', {ID: Blank()}, Form2.Updates, Form3.Updates));
If(PatchReturnRecord.ID > 0,
	Your actions on success,
	Your actions on failure
	)

Please also note that I have substituted the Defaults() function with a record that has blank primary key columns.  This is much more efficient than using the Defaults function, which has preformance issues.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (3,832)