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
CarlBCarlB 

"No such column" in managed package

Hello.

I have a customer's org into which I have installed a managed package.  On the org is some Apex code that calls a method in the managed package.  One of the things that the method does is make a SOQL select statement, but this fails saying "No such column".  However, if I run exactly the same SOQL statement outside of the managed package, it works.

Here is a sample of the code:
 
System.debug('HERE2: ' + [SELECT BillingAddress,ShippingStreet,ShippingCity,ShippingState,ShippingPostalCode,ShippingCountry,ShippingAddress,Phone,Fax,Website,Sic,Industry,AnnualRevenue,NumberOfEmployees,Ownership,TickerSymbol,Description,Rating,Site,OwnerId,CreatedDate,CreatedById,LastModifiedDate,LastModifiedById,SystemModstamp,LastActivityDate,LastViewedDate,IsPartner,IsCustomerPortal FROM Account Where Id in :setaccountId]);
Account member = (Account)(XXXXXXX.Util.getSObjects(setAccountId)[0]);

This is the debug log:
 
16:25:15.8 (1244514753)|SOQL_EXECUTE_BEGIN|[49]|Aggregations:0|SELECT Id, IsDeleted, MasterRecordId, Name, Type, RecordTypeId, ParentId, BillingStreet, BillingCity, BillingState, BillingPostalCode, BillingCountry, BillingAddress, ShippingStreet, ShippingCity, ShippingState, ShippingPostalCode, ShippingCountry, ShippingAddress, Phone, Fax, Website, Sic, Industry, AnnualRevenue, NumberOfEmployees, Ownership, TickerSymbol, Description, Rating, Site, OwnerId, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp, LastActivityDate, LastViewedDate, IsPartner, IsCustomerPortal FROM Account WHERE Id = :tmpVar1
16:25:15.8 (1278032882)|SOQL_EXECUTE_END|[49]|Rows:1
16:25:15.8 (1278087443)|HEAP_ALLOCATE|[49]|Bytes:8
16:25:15.8 (1278113162)|HEAP_ALLOCATE|[49]|Bytes:524
16:25:15.8 (1278151757)|HEAP_ALLOCATE|[49]|Bytes:8
16:25:15.8 (1278378087)|HEAP_ALLOCATE|[49]|Bytes:651
16:25:15.8 (1278413071)|HEAP_ALLOCATE|[49]|Bytes:658
16:25:15.8 (1278443969)|USER_DEBUG|[49]|DEBUG|HERE2: (Account:{Id=0014E00000BAA5FQAX, IsDeleted=false, Name=Prasad Household, RecordTypeId=0124E0000004PsOQAU, BillingStreet=Bill1, BillingCity=Bill City, BillingState=State, BillingPostalCode=Postal, BillingCountry=UK, BillingAddress=API address [ Bill1, Bill City, State, Postal, UK, null, null, null, null, null], ShippingAddress=null, OwnerId=0054E000000L2viQAC, CreatedDate=2016-06-16 14:51:04, CreatedById=0054E000000L2viQAC, LastModifiedDate=2016-08-10 12:49:52, LastModifiedById=0054E000000L2p6QAC, SystemModstamp=2016-08-10 12:49:52, LastViewedDate=2016-08-10 14:43:09, IsPartner=false, IsCustomerPortal=true})
16:25:15.8 (1278457800)|STATEMENT_EXECUTE|[50]
16:25:15.8 (1288020530)|HEAP_ALLOCATE|[50]|Bytes:36
16:25:15.8 (1288035968)|HEAP_ALLOCATE|[50]|Bytes:159
16:25:15.8 (1288039088)|HEAP_ALLOCATE|[50]|Bytes:147
16:25:15.8 (1288069088)|METHOD_ENTRY|[1]|01p4E000000D3mS|Util.Util()
16:25:15.8 (1288073885)|STATEMENT_EXECUTE|[1]
16:25:15.8 (1288095397)|ENTERING_MANAGED_PKG|XXXXXX
16:25:15.8 (1288135086)|METHOD_EXIT|[1]|Util
16:25:15.8 (1288197449)|METHOD_ENTRY|[50]|01p4E000000D3mS|XXXXXX.Util.getSObjects(Set<Id>)
16:25:15.8 (1288210369)|ENTERING_MANAGED_PKG|XXXXXX
16:25:15.8 (1289170040)|ENTERING_MANAGED_PKG|XXXXXX
16:25:15.8 (1308239962)|SOQL_EXECUTE_BEGIN|[30]|Aggregations:0|SELECT Id,IsDeleted,MasterRecordId,Name,Type,RecordTypeId,ParentId,BillingStreet,BillingCity,BillingState,BillingPostalCode,BillingCountry,BillingAddress,ShippingStreet,ShippingCity,ShippingState,ShippingPostalCode,ShippingCountry,ShippingAddress,Phone,Fax,Website,Sic,Industry,AnnualRevenue,NumberOfEmployees,Ownership,TickerSymbol,Description,Rating,Site,OwnerId,CreatedDate,CreatedById,LastModifiedDate,LastModifiedById,SystemModstamp,LastActivityDate,LastViewedDate,IsPartner,IsCustomerPortal FROM Account Where Id IN :p_Ids
16:25:15.8 (1309713440)|METHOD_EXIT|[50]|01p4E000000D3mS|XXXXXX.Util.getSObjects(Set<Id>)
16:25:15.8 (1309785853)|VARIABLE_SCOPE_BEGIN|[43]|Ex|Exception|true|false
16:25:15.8 (1309879374)|VARIABLE_ASSIGNMENT|[43]|Ex|"common.apex.runtime.impl.ExecutionException: No such column 'BillingAddress' on entity 'Account'. 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."|0x1a7353e4

As you can see, the code in the managed package does the same SOQL select, but fails.

Note that this managed package works fine in other orgs

I have tried raising a case with Salesforce, but was told it was a "Developer Support Issue".

Thanks,

Carl







 
TintuBabuTintuBabu
Hi Carl,

Billing Address is made up of following fields : BillingStreet, BillingState, BillingPostalCode, BillingCountry, BillingCity. Make sure all these fields are there.

One more possibility is that do this org have any namespace. If so you need to add it as prefix for field names.
 
Kiran  KurellaKiran Kurella
It looks like the issue is related to Salesforce API Version of the Manage Package class. Try updating it and see if it resolves the issue.

To update Salesforce API Version of a Managed class, go to the Managed Package class in a browser, click Edit, click "Version Settings" tab and update Salesforce.com API version to the latest version.
Kiran  KurellaKiran Kurella
Here is the documention url
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/compound_fields_address.htm
CarlBCarlB
Yes, that was it.  My code was compiled under API version 1.29, but the fields were introduced after that.

However, I think it is pretty crappy that one part of Salesforce (the Describe API) returns a field that other parts can't then use - and there doesn't seem to be any way to get around it (other than updating the API version of my code)

Ho hum, another day dealing with the peculiarities of Salesforce