[SalesForce] Validation Rule, Make Lookup Field Required if Picklist Values Selected

Why does this validation rule give me syntax errors?

BUSINESS REQUIREMENT:

IF "agreement type" picklist field EQUALS "apple" OR "orange" AND "Related Member" lookup field IS empty THEN throw validation rule error message.

VALIDATION RULE:

AND(
OR(
ISPICKVAL(Agreement_Type__c, “apple”),
ISPICKVAL(Agreement_Type__c, “orange”)
),
ISBLANK(Related_Member__c)
)

Best Answer

The rule looks ok to me except for the quotes you have used around the values apple & orange..

I took the exact one you had in my dev org and it complained only on the quotes.. change it to single quote like belwo and it should work..

AND(
OR(
ISPICKVAL(Agreement_Type__c, 'apple'),
ISPICKVAL(Agreement_Type__c, 'orange')
),
ISBLANK(Related_Member__c)
)
Related Topic