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
BrianWKBrianWK 

Compile Error: Invalid field using Rich Text with a Test Class

We recently added a validation rule that requries a Rich Text Field to be filled in when the object is completed. This object is "Implementation" and the field is "Transition_Notes__c"

 

In my test classes where I have completed Implementation objects I've attempted to add Transition_Notes__c so the Validation rule doesn't impact my test class.

 

When I do this, I get "

Error: Compile Error: Invalid field Transition_Notes__c for SObject Implementation__c at line 56 column 9 

"

 

Normally I see this error when I make a typo. I've tried copy and pasting the API name. I've done this using the Apex Class GUI editor in Salesforce. I also tried the IDE in Eclipse using the auto-complete feature. And I still get this error.

 

Here's a snippet:

 

Implementation__c CompletedI1 = new Implementation__c();

        CompletedI1.Stage__c = 'Live (completed)'; 
        CompletedI1.Status__c = 'Completed';
        CompletedI1.Actual_live_Date__c = date.Today();
        CompletedI1.Completed_Date__c = date.Today();
        CompletedI1.Imp_Survey_Recipient__c = c1.id;
        CompletedI1.Transition_Notes__c = 'Filled in';
        update CompletedI1;

 I know the API name is right. I know it's attached to the right variable of the SObject. I can see the field in the Schema. What's going on?

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

Make sure you're set to api v20.0

All Answers

SuperfellSuperfell

Make sure you're set to api v20.0

This was selected as the best answer
gailhgailh

Thanks, Simon, you just saved me a heck of a lot of digging around :smileyhappy: