Forum Discussion
Validation for Sharepoint list (not a form)
I have a Sharepoint list that I have attempted to add list validation to. We are using the list version, not a form.
To add a entry the user clicks new" and fills out the entries and submits.
I have a field "Whos Your Caller". The choices for the field are Employee, Third Party, or Client.
If Third Party or Client is selected, Then the field titled "Caller Name/Location/Contact" needs to be required.
My research shows that the list validation formula should be
=IF(OR([Who's Your Caller?]="Client",[Who's Your Caller?]="Third Party"),IF(ISBLANK([Caller Name/Location/Contact]),FALSE,TRUE),TRUE)
When i test it, I select client and leave the Caller Name/Location field blank. The list allows me to submit, with no error message. However after refreshing I get a error message stating "sync issues couldn't upload new list item" (image of error below) .
This only appears after submitting the list item and purposely not meeting the validation I set forth above. At that point the only option given is to delete the items or save it (which downloads a csv). IT still does not state what the error is (although I know) or allow correction of the entry.
I would ideally like for the list to NOT allow to be submitted if the validation is not met. When they hit "Save" on the new list item, I want the error to pop up to advise that the field "Caller Name/Location/Contact" can not be left blank.
It appears I have the formula correct for the validation. But how do i get the error message to display on the list item entry itself?
I know how to accomplish this if I was using a form. I could use power apps to create an error message on the submit button. But since this is a list item not a form. Im not sure how to accomplish this. Any help would be appreciated. Thank you
Hi SPNewbie1,
I have created a new list on my tenant and applied your formula and it looks correct. (In my language, I need to use ";" as the parameter separator instead of ",".)
Then I get the correct validation on the form.
The error you encountered is something I haven't seen before.
In discussions on this topic, some people have mentioned that it can be caused by the URL column type.
Can you reproduce the same error on the newly created list?
- michalkornetIron Contributor
Hi SPNewbie1,
I have created a new list on my tenant and applied your formula and it looks correct. (In my language, I need to use ";" as the parameter separator instead of ",".)
Then I get the correct validation on the form.
The error you encountered is something I haven't seen before.
In discussions on this topic, some people have mentioned that it can be caused by the URL column type.
Can you reproduce the same error on the newly created list?
- SPNewbie1Copper ContributorCreating a new list worked. I wish i could figure out whats wrong with my current list since i already have so much data in it
- michalkornetIron Contributor
Hi SPNewbie1, Maybe deleting the mentioned URL type column can help with the corrupted list.
There are some methods to copy items to a new list. You can export items to CSV or Excel and then create a new list using the CSV or Excel file as a template.
There is also the old method of creating a list template including the content and then creating a new list from the created template. To do so, you need to perform the following steps:
1. enable script support for the site -> https://pnp.github.io/powershell/cmdlets/Set-PnPTenantSite.html#example-5
2. Save list as Template -> https://yourtenant.sharepoint.com/sites/yoursite/_layouts/15/savetmpl.aspx?List=%7BAD2B09CE%2DF694%2D4D9F%2D9952%2D911F836BBE22%7D <- here you have to provide your list GUID
3. Create a new list using the created template (in classic view) -> https://yourtenant.sharepoint.com/sites/yoursite/_layouts/15/addanapp.aspx
- SPNewbie1Copper Contributor
michalkornet thank you or responding and confirming my formula is correct. I will create a new list and see if that works.