I have recently created a managed package . To test it, I installed it in a fresh developer org. This package queries the account records and updates certain custom fields(part of the package) on those records. For this, I am using a scheduler which inturn calls a batch class that updates the fields on a hourly basis.

However, recently I have started getting an email for this package with error message saying "System.QueryException: sObject type 'Account' is not supported."

I am not pretty sure, why this is happening. This error message, I do not get it always. It occurs only sometimes, usually during weekends and that too once or twice in a day. Not sure if this is ssomething releated to salesforce scheduled maintenance. I checked trust.salesforce.com , but there was nothing mentioned about any maintenance activity.

  • Have you created any kind of custom diagnostics you can enable and disable in your package? Sounds like you might want write and then enable some kind of custom diagnostic logging on that particular class to capture more detail on what's actually going on. Anything else is going to be speculation. BTW, do you have any batch activity also going on in the org that generates Account activity data for your package test?
    – crmprogdev
    Commented Sep 1, 2013 at 15:17

1 Answer 1


Main reason for this error is one of your salesforce apex classes are declared without with sharing or without sharing . This causes unexpected behavior when a sharing enable class call a class which has no sharing type declared and enforce its sharing rule.

  • Thanks. I had to remove the with sharing keyword from all my classes that were directly/indirectly being called from the post Install script. It seems we cant have any classes referred by postinstall script with this keyword including the postinstall script.
    – sfdc2013
    Commented Sep 5, 2013 at 4:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .