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
Mirelis SotoMirelis Soto 

checkbox to mark true when many picklist values are selected

Hello, I have a picklist field (Not a multi-select just regular), I want a checkbox formula field to mark true when any of the many values is selected. 

For example field called Color__c. 

IF(ISPICKVAL( Color__c , 'Red') || ISPICKVAL( Color__c , 'Blue') || ISPICKVAL( Color__c , Yellow') || ISPICKVAL( Color__c , 'Green')  || ISPICKVAL( Color__c , 'Brown) || ISPICKVAL( Color__c , 'Pink') || ISPICKVAL( Color__c , 'Magenta' || ISPICKVAL( Color__c , 'Orange')|| ISPICKVAL( Color__c , 'Purple')  

 

But this is not working is missing something. I am new to formulas and I am not sure how to proceed from here. Any help is greatly appreciate it. 

Best Answer chosen by Mirelis Soto
SubratSubrat (Salesforce Developers) 
Hello ,

Your formula appears to be missing closing single quotes for some of the color values. Here's the corrected formula:
 
IF(ISPICKVAL(Color_c, 'Red') || ISPICKVAL(Colorc, 'Blue') || ISPICKVAL(Colorc, 'Yellow') || ISPICKVAL(Colorc, 'Green') || ISPICKVAL(Colorc, 'Brown') || ISPICKVAL(Colorc, 'Pink') || ISPICKVAL(Colorc, 'Magenta') || ISPICKVAL(Colorc, 'Orange') || ISPICKVAL(Color_c, 'Purple'), TRUE, FALSE)


This formula uses the ISPICKVAL function to check if the picklist field Color__c has any of the specified values selected. If any of the conditions evaluate to true, the formula returns TRUE; otherwise, it returns FALSE. You can replace TRUE and FALSE with any desired values depending on your requirements.


If this helps , please mark this as Best Answer.
Thank you.

All Answers

SubratSubrat (Salesforce Developers) 
Hello ,

Your formula appears to be missing closing single quotes for some of the color values. Here's the corrected formula:
 
IF(ISPICKVAL(Color_c, 'Red') || ISPICKVAL(Colorc, 'Blue') || ISPICKVAL(Colorc, 'Yellow') || ISPICKVAL(Colorc, 'Green') || ISPICKVAL(Colorc, 'Brown') || ISPICKVAL(Colorc, 'Pink') || ISPICKVAL(Colorc, 'Magenta') || ISPICKVAL(Colorc, 'Orange') || ISPICKVAL(Color_c, 'Purple'), TRUE, FALSE)


This formula uses the ISPICKVAL function to check if the picklist field Color__c has any of the specified values selected. If any of the conditions evaluate to true, the formula returns TRUE; otherwise, it returns FALSE. You can replace TRUE and FALSE with any desired values depending on your requirements.


If this helps , please mark this as Best Answer.
Thank you.
This was selected as the best answer
Mirelis SotoMirelis Soto
Thank you so much!!