Skip to main content

Posts

Showing posts from April, 2013

Cross Field Validation in SharePoint 2010

The requirement is simple. 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 c