• ch4val
  • 0 Points
  • Member since 2011

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1

Note I'm not positive the subject of this post is the true reason for the bug.  The other possible explanation is:

Dynamic SOQL requires namespace prefixes when called in global context


Anyway, the bug is:


Our managed package occasionally uses Dynamic SOQL.  In one case, we have a controller that uses Database.query() without any namespace prefixes:

Database.query('select CustomField__c from CustomObject__c');


In another case, we call Database.getQueryLocator() (as part of a Database.Batchable implementation).  That query also does not include the namespace prefix:

global Database.queryLocator start(Database.BatchableContext bc) {
return Database.getQueryLocator('select CustomField__c from CustomObject__c');



All of this works in our DE org, but once packaged & deployed, only the first one works.


The second ("getQueryLocator") throws an exception:

Developer script exception from iHance : 'i.Maintenance' : common.exception.ApiQueryException: No such column 'CustomField__c' on entity 'i__CustomObject__c'. 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.

I'm not sure if the bug is that getQueryLocator() requires the namespace prefix, or if Dynamic SOQL methods called in the global context do.  Without re-packaging everything to create a test case, there's no way for me to tell.


Salesforce support - I've created case 03501471 to track this issue.

  • April 23, 2010
  • Like
  • 0