Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I'm getting compilation errors in my trigger code when trying to use the following code to retrieve a Group Id:

Group corrections = [select Id,DeveloperName from Group where type = 'Queue' and DeveloperName = 'GroupCorrections'];

This returns:

No such column 'DeveloperName' on entity 'Group'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

The query

select Id,DeveloperName from Group where type = 'Queue' and DeveloperName = 'GroupCorrections'

returns both the Id & DeveloperName in my Sandbox developer console. I'm having a bit of a hard time understanding this.

I first thought that this was an API issue, but i see my code is targeting v23.0, and I tried to change it to change it to v27.0 on my sandbox, but to no avail.

share|improve this question

1 Answer 1

up vote 7 down vote accepted

The Group documentation states that the DeveloperName field is available in API version 24.0 and later.

The unique name of the object in the API. This name can contain only underscores and alphanumeric characters, and must be unique in your organization. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. In managed packages, this field prevents naming conflicts on package installations. With this field, a developer can change the object’s name in a managed package and the changes are reflected in a subscriber’s organization. Corresponds to Group Name in the user interface. This field is available in API version 24.0 and later.

Are you sure that your class is on v24.0 or later? You can see it by bringing up the class through the setup menu. Go to Develop | Apex Classes, find the class and click to view and then Edit it. Then change to the Version tab and change the Version in the picklist and hit save.

version edit mode

After you hit Save you should see the API Version changed in the list of Apex classes and you should be able to see it changed in the detail view (i.e., non-edit mode).

version view mode

I'm not sure how you are editing your Apex class, but if you are in the development mode footer and you are editing the class and the Visualforce page at the same time and referencing DeveloperName in both of them, make sure that both of them are on the correct version.

share|improve this answer
    
Yeh, I had noticed that. I just tried to change the API version in the metadata .xml file for the class. I changed it successfully in the UI and now this works just fine. Thanks Peter, I'll mark the answer as correct. –  akarnid Dec 22 '13 at 9:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.