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

Error Handling - Patch/Submit Form (Multiple Forms)

Hello Community. I'm a new developer and am challenged with a situation. I have an App that has inputs from 4 different forms across 2 screens. Initially I tried SubmitForm(Form1);SubmitForm(Form2), etc but that gave me multiple rows for what I want all forms to be attributes of a single, new, record. Ideally I'd find a way to use this method but have it sumbitted as a single record because SubmitForm handles errors well. 

Second I've worked out how to Patch all of the form-fields as a single record but don't have any error handling like with SubmitForm. When I Preview the app and as an example, enter the same record ID twice, which is not allowed because my source requires unique values, it doesn't show me the error with the Patch. This error, along with other potential errors is a concern as I don't want users to go through the trouble of filling out all if the forms and thinking they submitted (via patch) but did not because of an undisclosed error.

Any help here would be appreciated. I've read of the Error function but can't seem to figure out how to piece it all together to show that the Patch didn't execute. 

 

Many Thanks,

-Nate

12 REPLIES 12

This is awesome. Thanks for sharing. Way beyond my current skills but I like seeing it and thinking through so I can learn from it. 

I was looking for your username yesterday.  I am building a new app and I came across a simpler solution. 

 

IfError(Patch(COVID19Checklist,SubmitData),Notify("There was an error with your submission, please retry",NotificationType.Error)&&Set(Error10,1));If(Error<1,Notify("Submission was successful",NotificationType.Success));If(Error10<1,Clear(SubmitData));Set(Error10,0)

 

I'm sure there is probably a better way to do this but at first glance this works.  I still need to test it out a bit more and hopefully refine the code a wee bit.

That looks pretty clean. Thanks for sharing.

I ended up kind of hacking the submission by having the multiple forms fill out another, singular form on a hidden page and I just submit that on its own. That allows me the use of the built in 'positives' to the form submissions and all, just starting out and all. I've since piggy-backed a patch onto the OnSuccess of that singular form for populating another table... I'm learning, haha. 

One thing that's puzzling me now that my on OnFailure message of the singular form will not appear after published. It appears fine when I'm previewing the app, but not after published. Any ideas there? Here's what I have in OnFailure:
Notify(NEWFullSubmission_Form.Error, NotificationType.Error)

Am I missing something?

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

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (4,086)