+ Start a Discussion

Can not able to fetch the inactive users from Chatter Groups

Hi All,


I am trying to delete inactive users from the Chatter groups. But when I try to query CollaborationGroupMember or groupmembers (like SELECT Id, Name,(select id, MemberId from groupMembers where MemberId='xxxxxxxxxxxxx') FROM CollaborationGroup) I only get the active users.

But when I query for public groups, we get  inactive users also.

(SELECT Id,UserOrGroupId FROM GroupMember where groupid='00Gxxxxxxxxxx')


I would like to delete the users in chatter groups which are inactive. When an inactive user is activated, that automatically show up in chatter groups/public groups. I dont want to enable them in those groups which they were in.


Please suggest how we can delete inactive users form chatter groups.






I am also not getting any results when query on inactive user, it seems it is as per design.


I would suggest you a work around, create a role with the name "Inactive' assign this role to inactive users and then query with role equals to inactive and this is how you would be able to find inactive users.

Seema Rani 3Seema Rani 3

You can run below query to find inactive users in chatter group.

select id, name, isactive,email,username from user where id in (SELECT memberid from CollaborationGroupMember WHERE CollaborationGroupId = 'XXXXXXXXXXX'
) and isactive=False

Blog - http://salesforcecodelearn.blogspot.in/
linkedin- https://www.linkedin.com/in/seema-rani-2b409612