Forum Discussion
Customize Forms Using PowerApps: Validation Issues
Microsoft never resolved this issue, even after I reported a likely cause to them. Please see if the work-around below resolves this issue for you. I'd really like to know (a) if this pertains to your situation and (b) if it does, what the result is of using it.
-----------
I've now identified the likely cause of this issue. It can be stated as follows: When there are validation formulas on non-required columns, the columns are treated as required. More specifically, it appears that some process executes column validation formulas against empty strings.
The first image below shows the symptom of this: all required columns have valid data, but two optional columns with SharePoint validation formulas, Mobile Number and Email, do not. PowerApps displays a non-specific error message, seemingly about Entry Date.
The second image below shows what happens when Quick Edit is used to attempt to add a new record. This time, probably because the process is within SharePoint, the column validation error message for Mobile Number displays, even though the column is optional and no data has been entered.
To essentially prove that this is the issue, I modified the validation formulas for both Mobile Number and Email, adding an or ISBLANK(<column name>) to each. The revised formulas are:
- Mobile Number: =OR(AND(LEN([Mobile Number])=12,IF(LEFT([Mobile Number],2)="+1",TRUE,FALSE),IF(ISNUMBER(RIGHT([Mobile Number],10)+0),TRUE,FALSE)),ISBLANK([Mobile Number]))
- Email: =OR(AND(ISERROR(FIND("",Email,1)),IF(ISERROR(FIND("@",Email,2)),FALSE,AND(ISERROR(FIND("@",Email,FIND("@",Email,2)+1)),IF(ISERROR(FIND(".",Email,FIND("@",Email,2)+2)),FALSE,FIND(".",Email,FIND("@",Email,2)+2)<LEN(Email))))),ISBLANK(Email))
With the revised formulas I was able to save a new record with only the required columns having data.
I have a URL column and it is not a required field. It works fine when user does not enter the value. However, it the user enters text (not a URL), it does not save and it does not give an error message. It seems that it is validating if the string is a URL field but does not display the error message.
- Joseph BolandJul 03, 2018Brass Contributor
According to https://docs.microsoft.com/en-us/dynamics365/customer-engagement/customize/types-of-fields, a URL field is just a text field with URL formatting and a rule that text entered that doesn't begin with "http://" (or "https://") will have "http://" prepended to it.
What if you add validation in PowerApps that requires a valid URL? In other words, what if you make sure that only syntactically valid URLs are entered before a save action can be performed?
- Suseela KodaliJul 09, 2018Copper Contributor
Issues is not displaying the error message on the validation - when I click on save, it shows dots to save but there is no action. When I go and enter valid url, it saves the form. Did you have issues displaying the error messages for the field validation?
- Joseph BolandJul 09, 2018Brass Contributor
In my case, PowerApps/SharePoint applied validation to an optional field when it was blank and failed to save. It also failed to display the error message associated with the field. The validation that created this problem was in SharePoint. I resolved this problem by adding a clause to the SharePoint validation to accept an empty string.
I did not have a problem with not showing an error message for an invalid field where the validation was in PowerApps.
I'm on vacation this week so may not be able to respond further until next Monday.