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
thuskerthusker 

Validation rule using multiselect picklist value--anyone able to help?

We have a multiselect field where we can note "Special Designations" for Accounts . . . can be things like Fortune 500 or other special groups we want to associate the Account to without having tons of check boxes.  We are also doing some cleanup/lockdown on some specially designated Accounts and I want to restrict users (except admins) from changing the Account Name if a particular value is selected in that Special Designations multiselect list--lets say that special designation is Fortune 500.  How would that validation rule be written?  I believe that multiselect lists can be included in validation rules now but I'm not sure how to actually do it.

 

I tried the following but I get an error trying to reference the multiselect picklist.  But I am crummy with formulas so not sure what the solution is.  Any suggestions would be gratefully welcomed!

 

AND( IF($User.ProfileId <>"00e70000000wI69", true, false),
 IF(
Special_Designations__c
,"Fortune 500", false), IF( ISCHANGED( Name ), true, false) )

Best Answer chosen by Admin (Salesforce Developers) 
MarkSilberMarkSilber

I was wrong. You need to use the new INCLUDES function with a multi-select picklist. I also had the syntax wrong for ISCHANGED. I just recreated in a dev org and tested -- it should work now.

 

 

AND(ISCHANGED(Name), $User.ProfileId <> "00e70000000wI69", INCLUDES(Special_Designations__c,"Fortune 500"))

 

 

 

All Answers

MarkSilberMarkSilber

Something like this should work:

 

 

AND(ISCHANGED, Name), $User.ProfileId <> "00e70000000wI69", ISPICKVAL(Special_Designations__c,"Fortune 500"))

 

I didn't test in an org, but functionally it should do what you are looking for. In validation rules, you don't need to use true and false since the entire statement has to resolve to false or the validation rule will trigger. You can also string together multiple conditions under the single AND as I have in the example above. In this case, all 3 have to be true for the validation rule to trigger.

 

thuskerthusker

Thanks, Mark.  I tried it out and I get the following Syntax error--an extra ",".  Any ideas?

 

MarkSilberMarkSilber

I was wrong. You need to use the new INCLUDES function with a multi-select picklist. I also had the syntax wrong for ISCHANGED. I just recreated in a dev org and tested -- it should work now.

 

 

AND(ISCHANGED(Name), $User.ProfileId <> "00e70000000wI69", INCLUDES(Special_Designations__c,"Fortune 500"))

 

 

 

This was selected as the best answer
thuskerthusker

Awesome . . . I will try it ASAP.  Thank you for your help!!!!!!!!!!!!!!!!!!!!

 

 

EDIT:  WORKED LIKE A CHARM--very cool!  Exactly what we needed!

Message Edited by thusker on 07-30-2009 08:12 AM