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
Pooja Singh 69Pooja Singh 69 

Get Picklist Length?

Hi All,

I would like to query picklist length but I don't find a way to do so. Is it possible using SOQL?

Thanks,
Pooja
Raj VakatiRaj Vakati
You can do in one simple Way ... 

Step1 : - Create a formula field to calculate the length of the picklist text 

here is the formula ( return type Number)  
 
LEN(Text(Competitor__c)) 

Use this value in SOQL
SandhyaSandhya (Salesforce Developers) 
Hi,

If you are using apex then value of the picklist is string so you can use string.length();

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_string.htm
 
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
                                             
Best Regards
Sandhya
 
 
Jolly_BirdiJolly_Birdi
Hello @Pooja

Do you want to calculate the length of selected picklist value length Or length of picklist values that it contains?
Please let me know.

Thanks,
Jolly Birdi