Learn SharePoint In Series - Part Eight - Validation Settings In List Settings

Introduction

This article is part 8 of the SharePoint series. You can find previous articles of the series here.

  1. Learn SharePoint In Series - Part One - Introduction
  2. Learn SharePoint In Series - Part Two - Web Application
  3. Learn SharePoint Series - Part Three - Site Collections
  4. Learn SharePoint Series - Part Four - Subsites
  5. Learn SharePoint Series – Part Five – SharePoint Lists
  6. Learn SharePoint In Series - Part Six - Power Of Versioning
  7. Learn SharePoint In Series - Part Seven - Lists Advanced Settings

In the previous article, I have explained various list-level settings available in SharePoint.Now in this article, I am going to cover the validation settings available in the SharePoint list.

This article is dedicated to exploring the following topics

  • Introduction to List Validation Settings
  • How we can use these validation settings
  • Benefits of configuring the list level validation settings
  • Available functions and statements in the Validation Formula
  • Summary

Introduction to list validation settings

If we talk about validations in SharePoint, then SharePoint provides mainly 2 levels of validation settings.In this article, we will be discussing validation settings applied at the list level. We will explore the field-level validation later on in this series.

Consider a real-world scenario where you have a list of new item forms with multiple fields. And now you have a requirement that the Obtain Marks should be less than the Total Marks. If the condition doesn’t satisfy then the item should not be added. We can apply this validation using list-level validation as well as column-level validation. But here we will be exploring the article via list-level validation.

How we can use these validation settings

To go to this setting page, please follow the below steps.

Step 1. Open the list in which you want to apply validation settings and click on List Settings.

Office 365 settings-

Step 2. Click on Validation Settings

Employee Directory Settings-

Step 3. Add your formulas to the Formula section.

Settings validation-

Here, what we want is that the item should not be saved if the Obtained Marks are greater than the Total Marks. Then the formula will be like.

=[Obtained Marks]<[Total Marks] 

Enter the text message that should be displayed if the validation fires and click on Save. Now open the list new item form. Try to enter value 25 into Obtained Marks and 50 into Total Marks and submit the form.

New item save-

It will save the record into the list as validation checks if the data are correct. Now, again, try with entering 50 into Obtained Marks and 25 into Total Marks and then try to submit the form. You will get the error message that you have specified in the Validation Settings.

New item error save-

So validation settings work in the explained manner.

Benefits of configuring the list level validation settings

As I said, the validation can be specified at list level and field level. Every approach has its own benefits and limitations. If you want to display the field-wise validation message then you can write the field-level validation code. But if you want to generalize the validation message and you want to manage every validation in one place then, in that case, you can use List Level Validation Settings.

The major benefits of configuring validations at the list level are, that we have to write every formula in one box and one general validation message is enough. This validation check is executed when we submit the form.

Available functions and statements in the validation formula

We already know some of the programming statements such as IF, Else, and functions like Date Functions, etc. The validation Formula also has its own set of Statements and Functions. The complete list of formulas and functions is available here Examples of common formulas in SharePoint Lists

Also, there is a well-written and great post on the same topic already available in CSharpCorner here Validation Settings In SharePoint 2013

Available are different kinds of formulas


Conditional formulas

In conditional formulas, we can make use of IF, AND, OR, NOT, ISERROR, and ISBLANK formulas available. For example, let’s demonstrate the use of the IF statement in SharePoint List Validation and traditional c#.

IF works the same as the If statement in C#, the only difference is with syntax. In C#, we write IF as

if (Condition) {
    // Condition is true
    Execute Success part
} else {
    // Condition is false
    Execute Failure part
}

If we write the above same situation in List Validations settings, it would be written as

=IF(Condition,”Success Part”,”Failure Part”)  

Summary

So in this article, we have seen how list validation settings work, although it's the basic information about how we can configure the list validations with a straightforward example. Utilizing list validation settings we can also configure business-level validations using some complex level formulas.

In the next article, I will be talking about audience targeting settings available in List. If you have any suggestions or questions please feel free to post a comment.


Hyper Cloud 365 Software Solution
Hyper Cloud 365 Software solution is a development and IT Consulting company.