[SalesForce] Validation Rule with multiple profiles

I've created a Validation Rule on Lead that is used to ensure users with profile names Direct Sale OR New Contract when the users login with those profile my validation rule should fire otherwise without those profile ignore the validation rules.

Without implementing profile logic the below validation works fine

NOT(OR(ISPICKVAL(Tech__c, 'IT'),  ISPICKVAL(Tech__c, 'RD'))) == true

The above validations check to see the Tech__c must be IT or RD and i have tested and its working

Problem:

Now when I try to add profile logic nothing works, here is what I have done so far with no success.

AND
(
 NOT(OR( 
         ISPICKVAL( Tech__c, "IT "),
         ISPICKVAL( Tech__c,"RD")
      )),
  AND(
         $Profile.Name == "Direct Sale", 
         $Profile.Name == "New Contract"
        )
)

I do not get any error and I able to save the validation rule and when I try to login as profile Direct Sale and the validation does not fire.

What I'm doing wrong here?

Best Answer

Your rule is written to only throw an error when the $Profile.Name concurrently matches two distinct values. This case is impossible. Use OR instead.

AND(
    NOT(OR(
        ISPICKVAL(...),
        ISPICKVAL(...)
    )),
    OR(
        $Profile.Name = "Direct Sale",
        $Profile.Name = "New Contract"
    )
)
Related Topic