5

We have a development instance with a managed package TMS. That package contains a custom object TMS__Task__c. Also we have another development instance with a managed package ABTS. TMS package is installed in ABTS development instance. Inside of ABTS package we have added a new custom field for TMS__Task__c custom object. A name of the field is ABTS__Bill_Item__c. We've installed those 2 packages to a brand new development instance. Using development console I am trying to get a value of ABTS__Bill_Item__c field but getting an error message:

System.QueryException: No such column 'ABTS__Bill_Item__c' on entity 'TMS__Task__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.

The code in development console is:

TMS__Task__c task = [
        SELECT ABTS__Bill_Item__c 
        FROM TMS__Task__c
        LIMIT 1];

My user is set to System Administrator profile and it has an access to that ABTS__Bill_Item__c field:

enter image description here

There is a screenshot of TMS__Task__c object's fields:

enter image description here

We have the same packages (TMS and ABTS) with the same versions installed in other instances and there such SOQL query works fine. So I believe there is some type of security issue or Salesforce bug.

3
  • since its managed package ,can you append namespace beside field followed by fieldname .namspace.fieldname May 6, 2015 at 12:47
  • Does the user that is trying to access that field have a license for the ABTS package?
    – BarCotter
    May 7, 2015 at 11:28
  • @BarCotter, both the packages are free. But I figure out the issue was that another package was expired and ABTS package was dependent on that third package. May 7, 2015 at 12:26

2 Answers 2

2

Fields need namespaces, if they are part of an installed managed package. It should be the same namespace as the object itself. If the field is custom and created within that org, it should have no namespace reference at all, since the org namespace will match.

Either this (if the field was in the managed package)

TMS__Task__c task = [
    SELECT TMS__Bill_Item__c 
    FROM TMS__Task__c
    LIMIT 1];

Or this (if the field was created by you in the managed custom object):

TMS__Task__c task = [
    SELECT Bill_Item__c 
    FROM TMS__Task__c
    LIMIT 1];

Depending on which of these scenarios fits you.

1
  • The object TMS__Task__c is created in TMS managed package but ABTS__Bill_Item__c is created in ABTS managed package. I've updated my initial post with a screenshot. May 7, 2015 at 11:24
1

I've found the reason of the issue. The issue was that another package was expired and ABTS package was dependent on that third package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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