+ Start a Discussion
Timothy SmithTimothy Smith 

Comparison arguments must be compatible types -- String

The field,  Milestone1_Project__c.Implementation_status__c,  is a Picklist in my If/Else statement used for comparison.  To my understanding I would treat it as a String.  However I am receiving:
Comparison arguments must be compatible types: Schema.SObjectField, String
 
Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
                        
                            if(Milestone1_Project__c.Implementation_status__c == 'LIVE - TRANSITION'){    
                                // Set Outgoing Email to Implementation Coordinator
                                //message.toAddresses = new String[] { 'test@test.com' }; 
                            }
                            else if (Milestone1_Project__c.Implementation_status__c == 'Live'){  
                                // Private method *** getAddresses() *** retrieves email address from Customer_Success_Managers Public Group
                                
                                //message.toAddresses = new String[] { 'test@test.com' };
                            }

 
Best Answer chosen by Timothy Smith
Timothy SmithTimothy Smith
I had the wrong Relationship name.  Solved.  Thanks!

All Answers

Danish HodaDanish Hoda
Hi Timothy, If the field is from parent object, you need to use Milestone1_Project__r.Implementation_status__c insead of Milestone1_Project__c.Implementation_status__c
Timothy SmithTimothy Smith
I had the wrong Relationship name.  Solved.  Thanks!
This was selected as the best answer