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
Ankit Singh 6Ankit Singh 6 

Need to update validation rule for Apex

There is a validation which ensures that country to be added when a new contact is created. If country is not present, it gives error for new contact.
ISBLANK(Country)

Now we want to ignore this validation for a particular account or you can say for a LeadSource. Please let me know how could I achieve that.
I have tried below rule but it did not work.

NOT(ISPICKVAL(LeadSource, "DiscoverOrg")) && 
ISBLANK(Country)
David ZhuDavid Zhu
You may change to single quotation mark.

NOT(ISPICKVAL(LeadSource, 'DiscoverOrg')) && 
ISBLANK(Country)
Ankit Singh 6Ankit Singh 6
Hi

I tried replacing double quotes to single, but still it did not work. Could you please provide any other workaround so that I can bypass the Country check for 'DiscoverOrg' leadsource.
 
David ZhuDavid Zhu
I tested on Lead and it worked.