Check in APEX if Chatter is enabled for current Org?

Answered

Does anyone know how I can check in APEX IF Chatter is enabled for the current Org?

I need to check either in a Visualforce page or in an Apex Class and display chatter if it is, and not display it if it is not enabled.

thanks

Asked on March 14, 2019 in APEX.
Add Comment
1 Answer(s)
Best answer

I found this on another site. Looks like exactly what you need.  Thanks for the help earlier.  😉

 

Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe(); 
if(gd.containsKey('FeedItem')){
   system.debug('Chatter is enabled!');
   return true;
}
else{
   system.debug('Chatter is disabled!');
   return false;
}
Answered on March 14, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.