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
User557User557 

Need to compare value with custom field of pick list datatype in SFDC

I am new to SFDC, I have a program where I'm passing the values and I need to compare these values with a custom object field where it is present or not.
Here is my code,
public class CheckUtility {

    public static ID determineFeature(ID defaultPersonaID, String Email, String Industry, String Title, Decimal Revenue, Integer EmployeeCount) {

        ID fetrID = defaultFeatureID;
        String emailDomain = Email.split('@').get(1);           
        Feature__c[] features = new Feature__c[]{};
        features = [Select id, Industries__c, Title_Tags__c, Email_Domains__c, Company_Revenue_From__c, Company_Revenue_To__c, Employee_Count_From__c, Employee_Count_To__c FROM Feature__c ORDER BY lastModifiedDate DESC];
        Integer industriesFound = 0;
        for (feature__c p: features) {
     // checking if there is a matching feature based on email    
        System.debug('Email Domains = ' + p.email_domains__c);        
             if (p.Email_Domains__c != null &&     
        p.Email_Domains__c.contains(emailDomain)) {
                 fetrID = p.ID;
                break;
             }

             if(p.Industries__c != null){ 
  //I am stuck compare the industry is present or not in the p.Industries__c (picklistdatatype)

               System.debug('Industries' + p.Industries__c);        
                 fetrID = p.ID;
                break;
             }
        }                

        return fetrID;      
    }      
}
Here I am stuck to compare with the input industry passed in the method is present in p.indutries__c which is pick list datatype and if available I need to return fetrID. Please suggest me how can I achieve this.
Raj VakatiRaj Vakati
try this
 
public class CheckUtility {

    public static ID determineFeature(ID defaultPersonaID, String Email, String Industry, String Title, Decimal Revenue, Integer EmployeeCount) {

        ID fetrID = defaultFeatureID;
        String emailDomain = Email.split('@').get(1);           
        Feature__c[] features = new Feature__c[]{};
        features = [Select id, Industries__c, Title_Tags__c, Email_Domains__c, Company_Revenue_From__c, Company_Revenue_To__c, Employee_Count_From__c, Employee_Count_To__c FROM Feature__c ORDER BY lastModifiedDate DESC];
        Integer industriesFound = 0;
        for (feature__c p: features) {
     // checking if there is a matching feature based on email    
        System.debug('Email Domains = ' + p.email_domains__c);        
             if (p.Email_Domains__c != null &&     p.Email_Domains__c.contains(emailDomain)) {
                 fetrID = p.ID;
                break;
             }

             if(p.Industries__c != null && p.Email_Domains__c.contains(p.Industries__c){ 
  //I am stuck compare the industry is present or not in the p.Industries__c (picklistdatatype)

               System.debug('Industries' + p.Industries__c);        
                 fetrID = p.ID;
                break;
             }
        }                

        return fetrID;      
    }      
}