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
Harshal Katole 7Harshal Katole 7 

multipicklist validation rule

picklist field : Course ===> c , cpp ,java,php
multiselecr picklist: Trainer ====> engineeing, bsc,msc,ma

validation rule : for c & cpp only bsc and msc trainer are allowed otherwise throen error.

pls help
VinayVinay (Salesforce Developers) 
Hi Harshal,

Try below snippet.
 
AND(
OR(ISPICKVAL(Course ,"cpp"), ISPICKVAL(Course ,"c")),
OR(NOT(INCLUDES(Trainer ,"bsc")), NOT(INCLUDES(Trainer ,"msc")))
)

https://trailhead.salesforce.com/content/learn/modules/point_click_business_logic/validation_rules

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Harshal Katole 7Harshal Katole 7
doubt 
1. trainer field is multiselect picklist , so how can we use ISPICVALUE insted of INCLUDE()
2. when to use TEXT(). i m bit confused . bcz in course field u did not use TEXT() and trainer field u used TEXT()
 
VinayVinay (Salesforce Developers) 
Yes you are right,  I missed out multi-picklist,  Use INCLUDES instead.

Something like INCLUDES(multiselect_picklist_field, text_literal).

Thanks
Harshal Katole 7Harshal Katole 7
AND(
OR(ISPICKVAL( Technology_of_Training__c  ,"Cpp"), ISPICKVAL( Technology_of_Training__c  ,"C")),

OR(NOT(INCLUDES(TEXT( Education__c  ,"Bsc"))), 



NOT(INCLUDES(TEXT( Education__c  ,"Msc"))))
)

Error: Field Technology_of_Training__c is a multi-select picklist field. Multi-select picklist fields are only supported in certain functions.
 
VinayVinay (Salesforce Developers) 
Try below.
OR(ISPICKVAL( TEXT(Technology_of_Training__c  ,"Cpp")), ISPICKVAL( TEXT(Technology_of_Training__c  ,"C"))),
Harshal Katole 7Harshal Katole 7
What about 2nd doubt vinay. ie TEXT(). when to use ?
Harshal Katole 7Harshal Katole 7
AND(
OR(INCLUDES( TEXT(Technology_of_Training__c  ,"Cpp")), INCLUDES(TEXT( Technology_of_Training__c  ,"C"))),

OR(NOT(ISPACKVAL(TEXT( Education__c  ,"Bsc"))), 


NOT(ISPICKVAL(TEXT( Education__c  ,"Msc"))))
)

=======NOT WORKING=======
Technology_of_Training__c  ======  Multiselect piclist
Education__c ======= pickist
 
VinayVinay (Salesforce Developers) 
Try below
AND(
OR(INCLUDES(Technology_of_Training__c,'Cpp'), INCLUDES(Technology_of_Training__c,'C')),
OR(ISPICKVAL(Education__c,'Bsc'),
ISPICKVAL(Education__c,'Msc'))
)

TEXT - Converts a percent, number, date, date/time, or currency type field into text anywhere formulas are used. Also, converts picklist values to text in approval rules, approval step rules, workflow rules, escalation rules, assignment rules, auto-response rules, validation rules, formula fields, field updates, and custom buttons and links.

Thanks,
Harshal Katole 7Harshal Katole 7
======Throw Error======
 if we choose C & Msc, then it will thrown error. its not case
Cruz KingCruz King
I've tried using the AND ( OR (ISPICKVAL (Course, "cpp"), ISPICKVAL (Course, "c")), OR (NOT (INCLUDES (Trainer, "bsc")), NOT (INCLUDES (Trainer, "msc"))) ) and it helped me a lot. This study is so hard for me! I often turn to https://edubirdie.com/do-my-math-homework for help with math homework, but I realize that I cannot do this forever. I really want to become a real smart developer, but more and more often I think that my brain is arranged in a more humanitarian way.