Hi I need to to iterate over the sObject as --> Schema.PicklistEntry for this i have created the for loop to iterate over it but getting below error, can anyone help me out for this.

{`List<Schema.PicklistEntry> aFamily= fieldResult.getPicklistValues();

for(Schema.PicklistEntry ASD: aFamily) {
    if (ASD!= 'BK-AIS') {
        whereClauseBuilder += 'AND ABC__c = ' + ASD;

I am getting below error on line if(ASD!='BK-AIS)' can anyone help me out : Comparison arguments must be compatible types: Schema.PicklistEntry, String

1 Answer 1


Look what is "ASD", ASD is Schema.PicklistEntry. Now you are comparing it with 'BK-AIS' which is string. Which is a problem you can not compare two different types.

So you can compare with any either values:

if (ASD.getLabel()!= 'BK-AIS') OR

if (ASD.getValue()!= 'BK-AIS')

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .