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
imrohitimrohit 

First error: Insert failed. First exception on row 0; first error: LIMIT_EXCEEDED, Maximum per user active group limit reached.: []

Hello All,

I am trying to insert collaborationGroup and adding my users to this group but it is failing for some users and I am getting the above error.

Has anybody aware of this problem. Please help to sort this out.

Thanks in advance

SwethaSwetha (Salesforce Developers) 
HI Rohit,
Can you try to insert using the below code in developer console and see if you are seeing the same?
 
CollaborationGroup g = new CollaborationGroup();
g.Name = 'Test Group';
g.OwnerId = '0051H000009P2AwABX'; // try with different users and verify if error occurs for specific users
g.CollaborationType = 'Private';
g.NetworkId = '0DB1H000000pqlwAAA';
insert g;

Also, can you check if you have hit the limit of "Maximum number of entities that a user can subscribe" If not, have the limit increased as per https://help.salesforce.com/articleView?id=000339872&type=1&mode=1

Also. consider checking the Maximum Chatter Groups a user can join limit on your Org and check if it exceeds.

Running the query for the user select id FROM CollaborationGroup where OwnerId = '0051H000009P2AwABX' and IsArchived=true 
 will give list of archived groups that can be removed for the related ownerid.

​​​​​​​Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
Krishna ShahiKrishna Shahi
Hi @imrohit,
Hope this helps you.

1)  Before Inserting the 'EntitySubscription' record, Get the count() subscription-id. 
2)  If the subscription-id count() is greater then 500, then delete the older EntitySubscription records first, then proceed with inserting the new EntitySubscription records.

Click here for more detail (http://ryanfoundsolutionsfdc.blogspot.com/2016/10/limitexceeded-maximum-per-user.html)

Please mark this answer as best so that others facing the same issue will find this information useful.
Thank you