0

I am trying to create Chatter Groups through APEX using the code below.

CollaborationGroup newGroup = new CollaborationGroup();  
newGroup.OwnerId = userId;  
newGroup.NetworkId = communityId;  
newGroup.Name = 'test name';  
newGroup.Description = 'test description';  
newGroup.CollaborationType = 'Public';  
newGroup.IsAutoArchiveDisabled = true;  

insert newGroup;

When I run the above code in developer console , its working fine without any exception and creating Group.

But when I used the same in my code its giving me a "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY" exception.

Log:--- 18:05:20.635 (635748748)|EXCEPTION_THROWN|[1139]|System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: [] 18:05:20.636 (636373991)|SYSTEM_MODE_EXIT|false 18:05:20.636 (636470947)|FATAL_ERROR|System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []

Please suggest how to solve above problem .

Thanks
Arabinda

  • 1
    By the looks of it, either userId or communityId are causing the issue - I would start by checking they are valid group owners/community Ids first – BritishBoyinDC Sep 29 '14 at 2:27
  • Are you able to resolve this issue? – Gopi Jun 11 '15 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.