+ Start a Discussion
PEFPEF 

About MultPicklist count

I have a Picklist named as "No of persons " which contains 1,2,3,...etc values.
I also have one multipicklist which contains name of persons.
so if i select 2 as no of persons then i want to restrict users to select exactly 2  values from multipicklist.
how to do this with validation rule or formula?

 
Sergio AlcocerSergio Alcocer

If you don't mind

  • having to keep the validation rule updated every time you add/change values on the multi-picklist,
  • Blocking / ignoring values that are not part of the picklist / validation rule
you could do something similar to what is in this other topic https://success.salesforce.com/answers?id=90630000000h1cIAAQ

That would be something like...

VALUE(NoOfStudent__c) !=
IF(INCLUDES(PersonName__c, "John Doe"), 1, 0) + 
IF(INCLUDES(PersonName__c, "Jane Doe"), 1, 0)
/* etc. */
If this solves your question, mark it to help others find it easier, and me to get happier :P
PEFPEF
Thanks Soni Piyush for your replay.But i don't wanted to write trigger.
anyway thanks again.

 
PEFPEF
thanks Sergio Alocer,
your solution helps me a bit.but still it gives me error like "Picklist fields are only supported in certain functions".
Sergio AlcocerSergio Alcocer
/* Maybe replacing VALUE(NoOfStudent__c) != by... */
VALUE(TEXT(NoOfStudent__c)) !=
IF(INCLUDES(PersonName__c, "John Doe"), 1, 0) +
IF(INCLUDES(PersonName__c, "Jane Doe"), 1, 0)
/* etc. */