• Ruhi Bell 5
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
I work on a managed package which has a scheduled Apex job that runs daily. This job includes some code that gets our managed package namespace prefix and prepends it to our custom objects. For some reason when an organization has our managed package installed the scheduled job fails with the following error.

Failed to process batch for class 'kimbia_sync.DeleteKimbiaLogs' for job id '7071a00002zBrzq'
caused by: System.QueryException: sObject type 'ApexClass' is not supported.

I can run the same code in that org through the developer console and it works just fine. 

I found this issue on StackExchange (https://salesforce.stackexchange.com/questions/27113/invalid-type-sobject-type-apexclass-is-not-supported) but it's a few years old and the API Access feature is now deprecated. I opened a Salesforce support ticket asking if they could help out and they checked one of the affected orgs and it had the correct setting so I'm at a loss. 
I am working on getting team development processes in place for a managed package and having trouble with the namespace. I have our packaging org, my own development org, and our code set up in a repository. The problem is the namespaces don't exist in my developer org so I have to remove them from any queries, etc in the code. Once I have committed my code and am ready to add it to the managed package for a new version the namespace needs to be added back. What's the best process for this? I know there's a way to do this, I just don't know what it is.

Thanks!