Field and List Item Validation in SharePoint 2010 Lists

SharePoint 2010 Lists support Field Validation which enables you to validate the values.  Field Validation allow you to “specify the formula that you want to use to validate the data in this column when new items are saved to this list. The formula must evaluate to TRUE for validation to pass. “

Example: If your column is called "Company Name" a valid formula would be [Company Name]="My Company".

To Test out the Validation go to the List and Select List from List Tools

Click Create Column
image
The Enter Title of the Column and select type the type.  for this example I have a column name Employee Age which should be a number greater than 25
image 
Expand the validation section and Write your formula and message.  You should enter the try condition and message for wrong values.
image
Now Create or edit the existing item to test your formula
image
List item Validation Works same but we can write a formula to verify the item.  We can specify the formula you want to use to validate the data in this column when new items are saved to this list. To pass validation, the formula must evaluate to TRUE. For more information, see Formulas in Help.

Example: =[Discount]<[Cost] will only pass validation if column Discount is less than column Cost.

image
For this example I created two currency columns GrossSalary and Netsalary and my formula is that Net salary should be less than Gross Salary. 
image
I entered 20000 as Gross and 30,000 in Net Salary so the error message is visible in the status pane.  The different between column or field validation and Item validation is that the wrong value message in field will be visible in front of columns.
imageVery impressive 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s