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.
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.