Your problem is the OR statement. If Lost Code is "Non-Responsive / Unknown", it will not be "Disqualified", and vice versa. In other words, the OR condition will always be true. It should be AND. In addition, I believe you're using AND when you meant to use OR (as in, "if these three fields are not set properly, trigger an error"). Also, I feel like this should be at least three different validation rules, because you won't be able to show an error on a relevant field.
Your original formula should look like:
AND(
ISCHANGED(StageName),
ISPICKVAL(StageName,"Closed Lost"),
ISNULL(Diagnostic_Completion_Date__c),
Expansion_Opportunity__c = FALSE,
NOT(ISPICKVAL(Lost_Code__c,"Non-Responsive / Unknown")),
NOT(ISPICKVAL(Lost_Code__c,"Disqualified")))
Or, with de Morgan's Laws, we can convert the AND(NOT(),NOT())
into a NOT(OR())
, as in:
AND(
ISCHANGED(StageName),
ISPICKVAL(StageName,"Closed Lost"),
ISNULL(Diagnostic_Completion_Date__c),
Expansion_Opportunity__c = FALSE,
NOT(OR(ISPICKVAL(Lost_Code__c,"Non-Responsive / Unknown"),
ISPICKVAL(Lost_Code__c,"Disqualified")
)
)
)
What I believe you're trying to do is to check if any of the three fields are set incorrectly, which would look like this:
AND(
ISCHANGED(StageName),
ISPICKVAL(StageName,"Closed Lost"),
OR(
ISNULL(Diagnostic_Completion_Date__c),
Expansion_Opportunity__c = FALSE,
AND(
NOT(ISPICKVAL(Lost_Code__c,"Non-Responsive / Unknown")),
NOT(ISPICKVAL(Lost_Code__c,"Disqualified"))
)
)
)
As a practical matter, from a UX perspective, you should write one validation rule per field so you can attach the error to the appropriate field.