I have the following problem: my code uses ConnectApi.ChatterFeeds.postFeedElement and ConnectApi.ChatterFeeds.postFeedElementBatch methods to operate feed items. That works properly is Chatter is enabled for the org, but ... if it's disabled I can't even install my package because of Invalid class ChatterFeeds exception coming from my unit tests. I realize that some Chatter object aren't accessible when Chatter is disabled (for example FeedItem), but you can always write

SObjectType token = Schema.getGlobalDescribe().get('FeedItem');
SObject objPost = token.newSObject();

instead of

FeedItem f = new FeedItem();

Does anyone know if there is a workaround like that for ChatterFeeds class methods? Or I have to get rid of ConnectApi and rewrite my Chatter logic somehow else?

UPDATE (Sep 29 2015)

Salesforce team just confirmed it is a known behavior: ConnectApi expects Chatter to be enabled and that's a runtime check which can't be avoided.

UPDATE (Nov 10 2015)

Fixed by Salesforce in Winter'16 Patch 11.0 (already deployed to the most org). Details are here

1 Answer 1


You can use Connect API to detect the features your org is enabled

if(ConnectApi.Organization.getSettings().features.chatter) {
     //Logic here

Reference links


  • That won't help because it's a compilation problem, not a runtime. This class is not supported when Chatter is disabled.
    – Mike Raven
    Commented Sep 28, 2015 at 21:00
  • Other would be add try and catch around this and handle the catch ?Try and catch will work on all scenarios Commented Sep 28, 2015 at 21:02
  • Again, seems like that is a compilation error, so try catch doesn't help.
    – Mike Raven
    Commented Sep 28, 2015 at 21:18

You must log in to answer this question.

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