Hello Guys, Sometimes we need to fetch the picklist values dynamically in apex code.
For example: You have written a code for the two active values of the picklist but in future there could be more active values or may be one active value in that case your code will not work.
So today i am showing you a way to fetch picklist values dynamically there could be other ways but i used mostly this one.
For example : I have created a picklist field on Contact object. It has three active values

Apex Class:

Result:

Guys,If there is any other efficient then tell me in comments.
Leave a comment