Cross Field Validation in SharePoint 2010
List contains two columns. One
column is a drop down with values "Approved" or "Rejected".
Another column is Approved Date. If user selects drop down value as Approved,
Approved Date should become mandatory.
The end result looks like this
As you notice above, when the status is Approved and click on Save button, it prompts a custom message asking user to enter a date. This is achieved with absolutely no code! Here is how you can achieve it.
Go to List Settings, navigate to Validation Settings. Under Formula, enter the below code:
=IF(AND(Status="Approved",ISBLANK([Approved Date])),FALSE,TRUE)
Here Status and Approved Date are column names.
Under User Message field, enter any validation text. In my case, it is "If Status is Approved, Approval Date cannot be blank.”
Click Save. Now, test this code by entering a new value or changing an existing value. Similarly, one can build complex formula to put cross field validations without writing a single line of code.
The end result looks like this
As you notice above, when the status is Approved and click on Save button, it prompts a custom message asking user to enter a date. This is achieved with absolutely no code! Here is how you can achieve it.
Go to List Settings, navigate to Validation Settings. Under Formula, enter the below code:
=IF(AND(Status="Approved",ISBLANK([Approved Date])),FALSE,TRUE)
Here Status and Approved Date are column names.
Under User Message field, enter any validation text. In my case, it is "If Status is Approved, Approval Date cannot be blank.”
Click Save. Now, test this code by entering a new value or changing an existing value. Similarly, one can build complex formula to put cross field validations without writing a single line of code.
Attractive section of content. I just stumbled upon your site and in accession capital to assert that I get in fact enjoyed account your blog posts.
ReplyDeletesharepoint 2013 administration certification