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
NervosaNervosa 

Issue with turning Chatter off

Hi to everyone out there!

 

I've got an issue with turning Chatter off. There are such declarations in my controller in test method:

 

CollaborationGroup CgTest1 = new CollaborationGroup(Name = 'CgTest1', CollaborationType = 'Public');
		insert CgTest1;
		
		CollaborationGroup CgTest2 = new CollaborationGroup(Name = 'CgTest2', CollaborationType = 'Public');
		insert CgTest2;
		
		CollaborationGroupMember CgmTest1 = new CollaborationGroupMember(CollaborationGroupId = CgTest1.Id, MemberId = u.Id);
		insert CgmTest1;

 So when i'm trying to turn Chatter off the message being received - 

Cannot disable Chatter. It is referenced by the following components: 

I tried to put these declarations in try catch block - no results. I tried to make declarations only when 

Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe(); 
if(gd.containsKey('FeedItem'))

gd.containsKey('FeedItem') == true - still the same message.

 

Is there any workaround for such issue?

 

Thanks in advance.

NervosaNervosa
So maybe today anyone can help me? :)