function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MollymulesMollymules 

ConnectApi and Managed Package

Hey,

 

I've created an app that allows users to post  messages to each others Chatter feeds. 

This app uses "Chatter in Apex" (the ConnectApi), specifically 

 

ConnectApi.FeedItemInput feedItem = ChatterMessenger.convertToFeedItemInput(messageContent);

ConnectApi.ChatterFeeds.postFeedItem(null, ConnectApi.FeedType.UserProfile, userDetails[0].Id, feedItem, null);

The app is deployed as a managed package, however when I try to install the package on an organisation that has chatter disabled, the installation fails even though the Chatter dependency box is unticked. 

 

I know one of the solutions is to remove all references to Chatter and to use reflection as discussed  here but I was hoping to avoid this approach. Since "Chatter in Apex" is relatively new, I thought there might be a newer/better solution to handling the case where Chatter is not enabled by an organisation.

Best Answer chosen by Admin (Salesforce Developers) 
jody_blyjody_bly

As of 29.0, packages that include Chatter in Apex code can't install unless Chatter is enabled. I've passed along your feature request, though, so that's something :-).