cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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. 

 

Highlighted
Community Champion
Community Champion

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
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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