Ask Search:
Steve MolisSteve Molis 

Tips & Tricks: Using Checkboxes to test Validation Rule Formula Logic

The "Check Syntax" button in the Formula Editor only tests the Syntax of a Formula, not the Formula Logic.  

For example both ( A + B ) / C and  A + ( B / C ) are Syntactically correct, but they will return completely different (and potentially bad) results. 

Validation Rules are boolean, and so are Checkbox fields.  So if you ever want to test the Logic of a Validation Rule Formula, just create a hidden Formula Field that returns a Checkbox result and then put your Validation Rule Formula in it.

Then create a Report or a List View that displays all of the fields that your Validation Rule is evaluating, and your Formula(Checkbox) field side-by-side to check for loopholes.
User-added image

*** Caveat Alert *** 

Not all Functions, like ISCHANGED and PRIORVALUE are supported in Formula Fields 
Best Answer chosen by Jayson (salesforce.com) 
Steve MolisSteve Molis
PS.  I've added the Validation Rule Test custom Formula(Checkbox) field on most Standard Salesforce objects in the Autumn'19 release of my Custom Formula Field Mix-Tape unmanaged package

The package is free, but if you really like it and are feeling generous, there's a link to my PayPal in the package (no obligation)

Install URL = sforce.co/36wqroz
Password = UoweB33R

User-added image
 

All Answers

Tommaso BolisTommaso Bolis
Thank you Steve! Really intersting as always.
sakshi nagpalsakshi nagpal
wow Steve, great way to debug validation rules

Hats off !
Sai Rakesh PuliSai Rakesh Puli
Thanks Steve. this definetly helps in testing validation rule easily.
Ruslanas RURuslanas RU
Could someone please give me a hand in this matter :  ( https://success.salesforce.com/answers?id=9063A000000puR1QAI#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Reports_Dashboards&criteria=UNANSWERED&id=9063A000000puR1QAI )
Abhishek SinhaAbhishek Sinha
Thanks Steve, really nice way to debug the validations rules.
Steve MolisSteve Molis
PS.  I've added the Validation Rule Test custom Formula(Checkbox) field on most Standard Salesforce objects in the Autumn'19 release of my Custom Formula Field Mix-Tape unmanaged package

The package is free, but if you really like it and are feeling generous, there's a link to my PayPal in the package (no obligation)

Install URL = sforce.co/36wqroz
Password = UoweB33R

User-added image
 
This was selected as the best answer
Ajeet SinghAjeet Singh
Thanks Awesome , thanks
Steve MolisSteve Molis
 
*** Update ***


This method can be used to test other boolean events in Salesforce, like a Workflow Rule or Process Builder Trigger Formula.   The only caveat aside from the Functions not supported by Formula Fields that I already mentioned, would be removing the [ObjectName]. references in your Formula(Checkbox) field formula if you're testing a Process Builder Trigger