+ Start a Discussion

piclist values to integer values



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) 



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.