Transforming a Validation Rule Requirement into a Validation Rule

Creating a validation rule with Salesforce is fairly straightforward in most cases. When the requirement for a validation rule becomes sufficiently complex, there needs to be a way to transpose functional requirements into the formula itself.

Suppose the validation requirements come in the format:

if a and b then c and d and e and f

which is fairly common.

It’s not trivial how the resulting validation rule should look. Remember you need to come up with a formula that makes the above statement evaluate to false. According to basic propositional logic, the formula should read

a and b and not (c and d and e and f)

This is because the statement “if x then y” leads to this lookup table

x y statement
true true true
true false false
false true true
false false true

Thus, the only way to transpose a conditional statement into a propositional statement that is false is by constructing a propositional statement such that the predicate is true and the consequence is false. Q.E.D.

This entry was tagged , , . Bookmark the permalink.

One Response to Transforming a Validation Rule Requirement into a Validation Rule

  1. Ray Dehler says:

    It’s worth noting that I used this analysis today for some validation rule creation, so I find this extremely useful.

Comments are closed.