I am trying to make validation rule on Lead object where Email and City field are required.

Here is validation rule formula I wrote in validation rule.


However I am able to create/edit lead with either email or city field populated. I need both fields to be populated.

I was trying something like Email field is required and either City or Fax needs to be not blank.


Still it's not working as i expect. I can create/edit lead with just email field populated. It is not checking if either or City or Fax field has value or not.

What am I doing wrong here?

  • OR ( ISBLANK(Email), ISBLANK(City) ) May 6, 2020 at 21:23

1 Answer 1


I find that validation rules tend to need the reverse (inverse?, converse?, contrapositive? ...something) of what I'd normally do in Apex.

If the expression in your validation rule evaluates to true, you get the validation error.

In your first example, both Email and City need to be blank to trip the validation rule. That lines up with your observation, and is different from what you say you want.

A shift in mindset can help here. Instead of thinking "what must this data be to be valid?", try to think "what must this data be to be invalid?"

Invalid data in this first case is when either Email or City are blank.


In your second case, data is invalid if Email is blank, or (City and Fax) are blank.

Writing out a truth table can also be helpful to understand if what you have meets your needs (and what needs to change if it's not working)

let x = email is blank
let y = city is blank
let z = fax is blank
let a desired result of false = validation does not fail, record can be saved

  x       y       z  | desired result
false | false | false|       false
false | false | true |       false
false | true  | false|       false
false | true  | true |       true
true  | false | false|       true
true  | false | true |       true
true  | true  | false|       true
true  | true  | true |       true

if x is true, validation should fail
if both y and z are true, validation should fail
that means our expression here is x || ( y && z)
  • 1
    so... bottom line OR(ISBLANK(Email),AND(ISBLANK(City),ISBLANK(Fax)) May 6, 2020 at 21:31
  • Thank you all for giving me a detailed answer. @Derek F's answer helped me lot in understanding of how to write formula.
    – Watson
    May 7, 2020 at 4:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .