Find your content:

Search form

You are here

Receive this error from installed package 'System.QueryException: sObject type 'CollaborationGroup' is not supported.'


I am getting the error -

'System.QueryException: sObject type 'CollaborationGroup' is not supported.'

When running the following code as part of a managed package by scheduled apex:

List groups = [select id, name, description from collaborationGroup];

What's strange is that the code works if I run it in the developer console but not when it runs from scheduled apex (setup as part of a post install script).

I've got 'with sharing on' so could it be down to the installer user profile? It works in some installed instances but not others but can't see a reason e.g. SFDC edition, profile, chatter settings, etc...

I do know that Chatter has to be enabled but that is the case anyway in the partnerforce dev orgs.

What am I missing here?

Attribution to: Richard Durrant

Possible Suggestion/Solution #1

It looks like your querying for Group, as in a user group instead of a Collaboration Group which is the API name for a Chatter group

List<CollaborationGroup> chatterGroups = [SELECT Id FROM CollaborationGroup];


List<Group> groups = [SELECT Id FROM Group];

Try explicitly querying for CollaborationGroup to get the type correct

Attribution to: jordan.baucke

Possible Suggestion/Solution #2

Your code must be run in a without sharing context in order for it to have access to the CollaborationGroup SObject. I'm guessing that your Utility class which contains the query is not explicitly declared as without sharing, so you can do one of two things:

  1. Move all of your code into your actual PostInstall Script Apex class (the one that implements InstallHandler).
  2. If possible, change the signature of your Utility class to be without sharing.
  3. Extract out the particular logic that executes this query into a separate Utility class that is declared as without sharing.

Attribution to: zachelrath
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content