Skip to main content

Validation rules writing conventions

  1. All Validation Rules MUST contain a Bypass 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.

  6. Validation Rules MUST NOT be triggered in a cascading manner.1


Name Formula Error Message Description
OPP_VR01_CancelReason !$User.IsCanBypassVR__c &&
TEXT(Cancellationreason__c)="Other" &&
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 !$User.IsCanBypassVR__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]

1 Cascading Validation Rules are defined as VRs that trigger when another VR is triggered. Example: A field is mandatory if the status is Lost, but the field cannot contain less than 5 characters. Doing two validation rules which would trigger one another would result in a user first seeing that the field is mandatory, then saving again, and being presented with the second error. In this case, the second error should be displayed as soon as the first criteria is met.