# Validation rules writing conventions 1. All Validation Rules MUST contain a Bypass2 Rule check. 2. Wherever possible, a Consultant ***SHOULD*** use operators over functions. 3. All possible instances of `IF()` ***SHOULD*** be replaced by `CASE()` 4. Referencing other formula fields should be avoided at all cost. 5. In all instances, `ISBLANK()` should be used instead of `ISNULL`, as per [this link](https://help.salesforce.com/apex/HTViewHelpDoc?id=customize_functions.htm&language=en#ISBLANKDef). 6. Validation Rules ***MUST NOT*** be triggered in a cascading manner.1 ### Examples
Name | Formula | Error Message | Description |
---|---|---|---|
OPP\_VR01\_CancelReason | `!$Setup.Bypasses__c.IsBypassVR__c && TEXT(Cancellationreason__c)="Other" &&ISBLANK(OtherCancellationReason__c)` | If you select "other" as a cancellation reason, you must fill out the details of that reason. \[OPP\_VR01\] | Prevents selecting "other" less reason without putting a comment in. \[OPP\_VR01\] |
OPP\_VR02\_NoApprovalCantReserve | `!$Setup.Bypasses__c.IsBypassVR__c && !IsApproved__c && ( ISPICKVAL(Status__c,"Approved - CC ") || ISPICKVAL(Status__c,"Approved - Client") || ISPICKVAL(Status__c,"Paid") )` | The status cannot advance further if it is not approved. \[OPP\_VR02\] | The status cannot advance further if it is not approved. \[OPP\_VR02\] |