0

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?

1

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"
    )
)
  • quick question i can post as new question but the thing i'm trying to fix is, adding an IF condition to it but no errors found but the logic is not working - is that the correct way to do it?` IF(ISPICKVAL(Status, 'Progress'), AND( NOT(OR( ISPICKVAL(...), ISPICKVAL(...) )), OR( $Profile.Name = "Direct Sale", $Profile.Name = "New Contract" ) )) – Nick Kahn Dec 14 '16 at 18:50
  • Is it just one more condition for the outer AND clause? – Adrian Larson Dec 14 '16 at 18:51
  • yes it one more condition so i have check if the pickval status = progress then rest of the condition should apply – Nick Kahn Dec 14 '16 at 18:55
  • 1
    Right, so just add it like the other outer AND clauses. AND(/*status clause*/, /*type clause*/, /*profile clause*/) – Adrian Larson Dec 14 '16 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.