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
sai007sai007 

Compare MultiSelectPickList with Picklist

Hi All,

I have a MultiSelectPickList field in User and Picklist in custom object. I need to compare such a way that piclist value is present in MultiSelectPickList in validation rule. I tried using INCLUDES($User.MultiSelectPickList,TEXT(Picklist)) but I got Error: Incorrect parameter type for function 'INCLUDES()'. Expected Text Literal, received Text. I analised this error and i got solution from here
https://ipfs-sec.stackexchange.cloudflare-ipfs.com/salesforce/A/question/148489.html to use triggers. 

Now my question is, is there any way to compare rather than using triggers. is there any  way to compare in  Condition Formula in validation rule 

Thanks,
sai
 
Best Answer chosen by sai007
Herish SurendranHerish Surendran
You can refer the link https://trailblazer.salesforce.com/ideaView?id=08730000000gpVdAAI . It has example similar to your usecase.

All Answers

Herish SurendranHerish Surendran
Hi Sai. The format of using INCLUDES is like this INCLUDES(multiselect_picklist_field, text_literal). Example : -  INCLUDES(Hobbies__c, "Golf") returns TRUE if one of the selected values in the Hobbies custom multi-select picklist field is Golf.
sai007sai007
Hi herish ,
yes I know  in this  INCLUDES($User.MultiSelectPickList,TEXT(Picklist)) insted of TEXT(Picklist) can I Use like this INCLUDES($User.MultiSelectPickList,Picklist) but ==> Picklist -> it is also pick list in custom object. 
Herish SurendranHerish Surendran
You can refer the link https://trailblazer.salesforce.com/ideaView?id=08730000000gpVdAAI . It has example similar to your usecase.
This was selected as the best answer
Herish SurendranHerish Surendran
No you can't use it like this  INCLUDES($User.MultiSelectPickList,Picklist). You have make use of  TEXT() function to convert the picklist value as text .
sai007sai007
I used TEXT() function and posted in my first question. even though I got the error  "Error: Incorrect parameter type for function 'INCLUDES()'. Expected Text Literal, received Text"