+ Start a Discussion
tmbarrytmbarry 

Error: Compile Error: Illegal assignment from Schema.SObjectField to String at line 7 column 1

Can someone help with this error message?

 

trigger SD_Member_Check_Member_Status on SD_Member__c (after insert, after update) {
// If Master Status = Ineligible
// And Post Referral to CC Status = (In Treatment OR No Contact 30 Days OR No Contact 60 Days)

For (SD_Member__c SD : Trigger.new){

String MS1 = SD_Member__c.Master_status__c;
 
If(MS1 == 'Ineligible'){
  
 }


}
}

 The Issue is this line:  

String MS1 = SD_Member__c.Master_status__c;

 

The Master_Status__c field is a Formula (Text) field and the formula is:

 

If( 
TEXT( Post_Referral_to_CC_Status__c ) = "Graduated","Graduated", 

If( 
TEXT( Member_Eligibility_Status__c ) = "Ineligible-Cov", "Ineligible", 
If( 
AND (TEXT( Member_Eligibility_Status__c ) = "Ineligible-Geo",TEXT (Record_Invalid__c) <> "Override: Eligible Plan/Geo"), "Ineligible", 
If( 
AND (TEXT( Member_Eligibility_Status__c ) = "Ineligible-Plan",TEXT (Record_Invalid__c) <> "Override: Eligible Plan/Geo"), "Ineligible", 


If( 
TEXT( Post_Referral_to_CC_Status__c ) = "In Treatment - Active","In Treatment", 
If( 
TEXT( Post_Referral_to_CC_Status__c ) = "In Treatment - No Contact 30 Days","In Treatment", 
If( 
TEXT( Post_Referral_to_CC_Status__c ) = "In Treatment - No Contact 60 Days","In Treatment", 
If( 
TEXT( Post_Referral_to_CC_Status__c ) = "In Treatment","In Treatment", 
If( 
TEXT( Post_Referral_to_CC_Status__c ) = "No Contact 30 Days","In Treatment", 
If( 
TEXT( Post_Referral_to_CC_Status__c ) = "No Contact 60 Days","In Treatment", 
If( 
TEXT( Post_Referral_to_CC_Status__c ) = "Ineligible - Medically Excluded","Ineligible", 
If( 
TEXT( Post_Referral_to_CC_Status__c ) = "Deceased","Ineligible", 
If( 
TEXT( Post_Referral_to_CC_Status__c ) = "Requires Higher Level of Care","Ineligible", 

If( 
TEXT( Member_Eligibility_Status__c )="Ineligible-LUSD","Ineligible", 
If( 
TEXT( Member_Eligibility_Status__c )="Ineligible-NonSD","Ineligible", 
If( 

TEXT( Catasys_Medical_Exclusion_Status__c )<>"Medically Targeted","Ineligible", 
if( 

AND (Len(TEXT( Record_Invalid__c ))>0,TEXT (Record_Invalid__c) <> "Override: Eligible Plan/Geo" ), "Ineligible", 

"Outreach Candidate" 
)))))))))))))))))
Best Answer chosen by Admin (Salesforce Developers) 
SaraagSaraag

I think you forgot to use SD. This should compile:

 

trigger SD_Member_Check_Member_Status on SD_Member__c (after insert, after update) {
// If Master Status = Ineligible
// And Post Referral to CC Status = (In Treatment OR No Contact 30 Days OR No Contact 60 Days)

For (SD_Member__c SD : Trigger.new){

String MS1 = SD.Master_status__c;

If(MS1 == 'Ineligible'){

}


}
}

 

Saraag

All Answers

SaraagSaraag

I think you forgot to use SD. This should compile:

 

trigger SD_Member_Check_Member_Status on SD_Member__c (after insert, after update) {
// If Master Status = Ineligible
// And Post Referral to CC Status = (In Treatment OR No Contact 30 Days OR No Contact 60 Days)

For (SD_Member__c SD : Trigger.new){

String MS1 = SD.Master_status__c;

If(MS1 == 'Ineligible'){

}


}
}

 

Saraag

This was selected as the best answer
tmbarrytmbarry
Unbelievable, it's the simplest things that will screw you up!!!!! Thanks for the extra set of eyes Saraag!
SaraagSaraag

You're welcome.