function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eric Boller 14Eric Boller 14 

Lead Validation Rule

Why does this work:

AND(NOT(ISPICKVAL( LeadSource , "Live Chat")) , NOT( $UserRole.Id = "00E70000001A1gy" ), ISBLANK( Phone ) )

But this doesn't (no syntax errors are thrown):

AND( OR(NOT( ISPICKVAL( LeadSource , "Live Chat")),NOT( ISPICKVAL( LeadSource , "Offline Message"))) ,  NOT( $UserRole.Id = "00E70000001A1gy"  ), ISBLANK( Phone )   )

How do I make the rule function so I can include mutlople lead source values?
Best Answer chosen by Eric Boller 14
CyberJusCyberJus
Because you are using OR, it is always going to meet your first criteria of your AND condition.

If the picklist value is "Live Chat" then you have:
Not Live Chat = false OR Not Offline Message = true
-- This will evaluate to TRUE

You probably need to remove the OR because what you really need is just the AND condition to filter if it is Not live chat and Not Offline Message. 

AND( NOT( ISPICKVAL( LeadSource , "Live Chat")),NOT( ISPICKVAL( LeadSource , "Offline Message")),  NOT( $UserRole.Id = "00E70000001A1gy"  ), ISBLANK( Phone )   )
 

All Answers

CyberJusCyberJus
Because you are using OR, it is always going to meet your first criteria of your AND condition.

If the picklist value is "Live Chat" then you have:
Not Live Chat = false OR Not Offline Message = true
-- This will evaluate to TRUE

You probably need to remove the OR because what you really need is just the AND condition to filter if it is Not live chat and Not Offline Message. 

AND( NOT( ISPICKVAL( LeadSource , "Live Chat")),NOT( ISPICKVAL( LeadSource , "Offline Message")),  NOT( $UserRole.Id = "00E70000001A1gy"  ), ISBLANK( Phone )   )
 
This was selected as the best answer
Eric Boller 14Eric Boller 14
That worked, thank you!