Data quality is very important in Salesforce. Salesforce provide a very helpful featured called “Validation Rule”. Developers / Administrators can create custom validation rule on Salesforce standard and custom objects.
Validation rules verify that the data a user enters in a record meets the standards you specify before the user can save the record. A validation rule can contain a formula or expression that evaluates the data in one or more fields and returns a value of “True” or “False”.
EXAMPLES OF VALIDATION RULES
1. Closed Date Must be Future Date
CloseDate < TODAY() && NOT(IsClosed)
2. A close reason is required when opportunity is closed lost
ISPICKVAL( StageName ,”Closed Lost”) && ISBLANK( Close_Reason__c )
3. Customer PO Number Required for this Stage
ISPICKVAL( StageName , “Closed Won”) &&
ISBLANK( Customer_PO_Number__c )
4. Dates of type delivery must be no later than 14 days after close date
ISPICKVAL(StageName, “Closed Won”) && ( Delivery_Schedule_Date__c – CloseDate ) > 14
5. Delivery Schedule Date is required for this stage
Validates that a custom field called Delivery Date is provided if an opportunity has advanced to the Closed Won or Negotiation/Review stage.
ISPICKVAL(StageName, “Closed Won”),
ISBLANK( Delivery_Schedule_Date__c )
6. Opportunity Amount Should not be Blank on some stage
Mira Shah is 2X Salesforce Certified / Platform Champion / 2X Salesforce Ranger / 7X Superbadge / Answer Leader on Salesforce community / Downunder Dreaming Speaker (Brisbane Edition)
She is a active blogger and founder of Miraforce.