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
amateur1amateur1 

piclist values to integer values

hi 

 

i have a piclist field where in i have given numbers from 1 to 10 now i want to access the integer values of the piclist how can i do that

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,

 

Query the Picklist value and the covert that value into integer as below:

 

Try the below code snippet as reference:

 

contact cc = [select id, picklist from contact where id = 'someid'];

integer intg = integer.valueof(cc.picklist);

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.