How to create Validation rules in salesforce :Validation rules in salesforce contains a formula or expressions that evaluates the data in one or more  fields in a record to meet the standards and returns a vale “True” or “False”. Validation rules displays error message to the user when the Condition is “False”.

As in our previous training article we discussed about validation rules in salesforce. In this Training tutorial we are able to know about how to create validation rules in salesforce.

How to create validation rules in salesforce ?

Now we are creating a validation rule in Custom objectStudent” for Subject S1, Subject S2, Subject S3 marks. Where the subject marks can not be greater than 100. If the user enters subject marks greater than 100 the record must not be created and error message should be displayed against the field. So that the user must enter valid marks in S1, S2, S3 subjects marks field.

Steps to create validation rules.

  1. Go to detailed view of the object.
  2. Go to validation section.
  3. Click on new (provide your rule name).

How to create Validation rles in salesforceHow to create Validation rles in salesforce

Enter rule name and in the formula editor provide formula as (S1__c>100,S2__c>100,S3__c>100).How to create Validation rles in salesforce

Provide error message  and give Error location as Top page or Field.How to create Validation rles in salesforce

Instead of writing validation rules for every subject we can give single validation rule as OR (S1__c>100,S2__c>100,S3__c>100).

Note : A validation rule can be made enforced only after making it as active otherwise it can’t.