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
Spandy cSpandy c 

hi, Could any one suggest how to query picklist field values using Soql

Sudipta DebSudipta Deb
Hi Spandy,

If you are tryng to retrieve Picklist Values and then use them into SOQL, it is possible. You need to first retrieve the picklist values using Dynamic Apex, store them into List an dthen use them into SOQL where statement. Please go through the below link to understand how to retrieve picklist values using Dynamic Apex -

To fetch picklist value for a particlay record you can use below SOQL statement -
SELECT Id, Name, toLabel(Type) FROM Account
You can use picklist values in where clause of SOQL also like -
SELECT ID, Name FROM Account WHERE  Type = 'prospect'
Please accept my solution as Best Answer if my reply is helpful.
Hai spandy,
          Example For multiselect picklist value :
proof is pancard or Aadharcard:
Select name,customer__name,balance__c  from customer__c where proof__c INCLUDES('pancard','Aadharcard'));   (Or condition)
Proof is pancard or Aadharcard and voterid:

Select name,customer__name,balance__c  from customer__c where proof__c INCLUDES('pancard','Aadharcard;voterid' ));
 (AND condition use ;)