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
Brenda Frambes 10Brenda Frambes 10 

Validation rule not working on Picklist change

I have a custom picklist field on a Person Account named "how did they hear about us" and then a dependent picklist named Sub Category.  Only some "How did they hear about us" selections require a "Sub Category".  An example would be Social Media.  If that is selected the Sub Category must be selected.  The Validation works on New Person Account records but when I test updating a record to a picklist item that should require a Sub Category the validation isn't enforced.  Here is my Validation Rule:

AND( ISPICKVAL ( PersonContact.How_did_they_hear_about_us__c , "Social Media"),ISPICKVAL ( PersonContact.Sub_Category__c , "" ))

Any suggestions?  Thank you in advance.
 
Best Answer chosen by Brenda Frambes 10
Sure@DreamSure@Dream
Hi Brenda

Try this:
AND( ISPICKVAL ( PersonContact.How_did_they_hear_about_us__c , "Social Media"),ISBLANK( TEXT(PersonContact.Sub_Category__c)))

If you have both these fields on a page layout, do the following things:
1. make them required from page layout.
2. Establish field dependency between these two picklists
By doing so, we can avoid validation rule.
 

All Answers

Sure@DreamSure@Dream
Hi Brenda

Try this:
AND( ISPICKVAL ( PersonContact.How_did_they_hear_about_us__c , "Social Media"),ISBLANK( TEXT(PersonContact.Sub_Category__c)))

If you have both these fields on a page layout, do the following things:
1. make them required from page layout.
2. Establish field dependency between these two picklists
By doing so, we can avoid validation rule.
 
This was selected as the best answer
Brenda Frambes 10Brenda Frambes 10
SO MUCH EASIER!  Thank you. I thought a required field was required, even if there wasn't a picklist item associated.  Learn something new everyday with Salesforce.  :)