How to get the picklist value in apex class?



How to get the picklist value in apex class?..

Answer / Ravi Kumar Ravi

To retrieve the selected value of a Picklist field in an Apex Class, you can use the 'get()' method. For example, if your SObject variable is named myRecord and the Picklist field is named myPicklistField, you can get its value by using: String picklistValue = myRecord.myPicklistField__c.get();

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Salesforce Interview Questions

Mention changing what may cause data loss?

1 Answers  


State the cause of error for insufficient privilege access in a partner community with external users. The user has proper owd and profile settings for any object.

1 Answers  


What is map class in apex salesforce?

1 Answers  


How to call a controller method within a javascript?

1 Answers  


What are the different ways to conditionally display markup, and what is the preferred approach?

1 Answers  


What are static resources?

1 Answers  


Which fields are automatically indexed in salesforce ?

1 Answers  


Can you edit an apex trigger/ apex class in production environment? Can you edit a visualforce page in production environment?

1 Answers  


What is hierarchical relationship in SFDC?

1 Answers  


Explain Summary Reports?

1 Answers  


What is sandbox and why do we use sandbox in salesforce?

1 Answers  


What is object relationship overview?

1 Answers  


Categories