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
Justin JulicherJustin Julicher 

Getting error on compile - Variable does not exist: DeveloperName

I'm currently getting this error when trying to compile the following piece of code.

if (objectRecordTypeMap.get(objectName) == null){
    for (RecordType r : [select DeveloperName, Id from RecordType where sObjectType =: objectName]){
     recordTypeMap.put(r.DeveloperName, r.Id);
    }
    objectRecordTypeMap.put(objectName, recordTypeMap);
  } else {
   recordTypeMap = objectRecordTypeMap.get(objectName);
  }

I'm using version 30 of the API and it was compiling just a few days ago... I'm unsure what has changed as I haven't really changed much apart from trying out mavensMate. 

any ideas anyone? 

thanks.
Best Answer chosen by Justin Julicher
Vinit_KumarVinit_Kumar
I am assuming you have an Apex class with the same 'RecordType'.Could you go ahead and verify that in your org ??

If this helps,please mark it as best answer to help others :)

All Answers

sandeep@Salesforcesandeep@Salesforce
Hi I have executed one part of this code where you are getting error but I am not getting any error message. Plese check it again.
Justin JulicherJustin Julicher
I'm still getting the issue - whether it is in the developer console or execute anonymous... it might be that something is wrong with my sandbox - if I try running the following in execute anonymous I get the error:

"Compile error at line 1 column 18 Loop variable must be an SObject or list of RecordType"

for (RecordType r : [select DeveloperName, name, Id from RecordType where sObjectType ='Case']){
	System.debug(r);
}
Except if I run the same SOQL in Force.com Explorer (Beta) I get all the record types for 'Case' - what is going on ?  



Justin JulicherJustin Julicher
And if I try running this as execute anonymous:

List<RecordType> types =  [select DeveloperName, name, Id from RecordType where sObjectType ='Case'];

I get:

Compile error at line 1 column 1
Illegal assignment from LIST<RecordType> to LIST<RecordType>

???
Vinit_KumarVinit_Kumar
I am assuming you have an Apex class with the same 'RecordType'.Could you go ahead and verify that in your org ??

If this helps,please mark it as best answer to help others :)
This was selected as the best answer