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
gaurav.sfdcgaurav.sfdc 

Batch Job failing in managed package

Hi,

We created a managed package and istalled in sandbox. We have a batch which failed with this error

First error: No such column 'myPrefix__Campaign__c' on entity 'myPrefix__XYZObject__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 de...

However the column very well exists there and If I use developer consol to to run query select myPrefix__Campaign__c from myPrefix__XYZObject__c the query runs perfect.

In my dev org this is working fine.

Any guess on this issue

Regards
Gaurav Khare
bob_buzzardbob_buzzard
Is the field level security set up correctly for that field - i.e. is it accessible to the profile that the batch job runs under?
gaurav.sfdcgaurav.sfdc
Hi Bob... Thanks for taking up my question.. but actually I figured out the issue. My batch class was using 'with sharing' and is failing when running under the ghost user (which got created when managed package is installed normally by the prefix name). After removing 'With Sharing' (which is not required in batch jobs) , it started working fine..