cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

How to display form errors - Currently no text!

I am struggling to use the built in error handling aspects of powerapps when submitting an item or modification to a sharepoint list.

 

My submission/update process is made up of a number of screens and forms. The commit is made on the last form (frmAssesment) using the following command:

 

If(frmDescription.Mode=New,Patch('System Inventory',Defaults('System Inventory'),frmDescription.Updates,frmHardware.Updates,frmOpSystem.Updates,frmWarranty.Updates,frmAssesment.Updates),....

 

On this form, I am INTENTIONALLY leaving mandatory fields BLANK so I generate errors. 

 

When viewing the form in the developer screen, I get a little yellow triangle with ! in it... and the message when I hover over reads "Field name:Field Required".

 

BUT... NONE of the data card errormessage text boxes get populated. Text=Parent.Error

 

I created a custom label (lblError) and set text to be frmAssesment.error as advised in the various exampels and tutorials.. and that stays blanks. BUT... the error exists, because lblError is made visible if(isempty(frmAssesment.error),false,true). This works fine!

 

To confirm that something was happening, I expanded the lblError.text code to read frmAssesment.ErrorKind &" "& First(Errors('System Inventory',frmAssesment.Updates)).Message and frmAssesment.ErrorKind &" "& frmAssesment.error and all that gets me is "0 "

 

I have even set the onfailure property of frmassesment to navigate to itself!

 

I was lead to believe that the patch command would enable me to extract/identify errors before the item was submitted to the sharepoint list.

 

Any guidance would be appreciated. I need to demonstrate this process ASAP. I work in an environment where data validation is important and process qualification is detailed. So error handling, and preventing idiots from doing the wrong this is important!

4 REPLIES 4
Highlighted
Community Support
Community Support

Re: How to display form errors - Currently no text!

Hi adstar22,

 

When using Patch function to create a new record, we are asked to specify a column name then the value to be updated.


The function might be configured looks like:
Patch( IceCream, Defaults( IceCream ), { Flavor: “Strawberry” } )


Please check this documentation about Patch for more details. I would suggest you check the Patch function configuration on your side.
https://powerapps.microsoft.com/en-us/tutorials/function-patch/

 

We can use error function to provide error information for previous change to a data source. Please refer to the documentation about Errors function for a reference:
https://powerapps.microsoft.com/en-us/tutorials/function-errors/

 

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper I
Helper I

Re: How to display form errors - Currently no text!

Hi, I'm not sure whether I have explained my issues clearly, as the patch command I am using is being questioned.

The patch methodology and command I am using is working absolutely fine... I am able to create new items, and update existing items, in a single action across multiple forms. It is actually a really neat piece of code which you guys helped me with!

 

The problem I have, is that if i deliberately leave out some mandatory fields.. an error exists... but I cant display it!

 

I know the error exists, because I have got the yellow triangle, and with the following command I get a "0" displayed:

 

lblerror.text=frmAssesment.ErrorKind &" "& frmAssesment.error

 

The problems are:

1) why don't any of the data cards, which all have "ErrorMessage" labels with the formula ErrorMessage21.text=Parent.error

2) why does the form.error not contain any text?

3) in the developer studio area, the yellow triangle identifies the field(s) which have an error... so the message exists.. why cant I see it/use it?!

Highlighted
Frequent Visitor

Re: How to display form errors - Currently no text!

 You probably need to set up the datasource with the Errors() function in order to catch or display errors whenever they occur on the DS.

 

Consult the documentation for more information about the Function.

 

The Patch function and other data functions don't directly return errors. Instead they return the result of their operation. After a data function executes, you can use the Errors function to obtain the details of any errors. You can check for the existence of errors with the [IsEmpty] function in the formula IsEmpty( Errors ( ... ) ).

You can avoid some errors before they happen by using the Validate and DataSourceInfo functions. See working with data sources for more suggestions on how to work with and avoid errors.

Errors Function

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: How to display form errors - Currently no text!

i don't think the patch function does any validation like the submit function does. there is a validate function that you can call from you script to validate the data.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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