I wanted to get list of chatter group that do not any posts and comments posted in last 6 months, so that we can take some action on those.
2 Answers
Just have to query the groups that have no FeedItems that were created in the last 6 months
Something like this should work
Date sixMonthsAgo= system.today().addMonths(-6);
List<CollaborationGroup> myGroup = [Select c.Name, c.Id From CollaborationGroup c
Where Id NOT IN (SELECT ParentId FROM CollaborationGroupFeed Where CreatedDate >: sixMonthsAgo)];
I'd just wait, actually. Winter 14 will see the capability of archiving Chatter groups appear in Chatter. From the release notes:
"By default, groups are set to archive automatically if there are no new feed posts or comments for 90 consecutive days. Groups are reviewed for feed activity and automatically archived on a weekly basis.Group owners, group managers, and users with the "Modify All Data" permission can manually archive and activate groups, or enable and disable automatic archiving for a group at any time."
Begin educating your users today, because you know who they will come to when they suddenly see some group they created six months ago archived.
-
1You can create a report on Chatter Groups which have LastFeedModifiedDate greater than n days. You could use such a report to assess which groups would be candidates for archival when Winter'14 arrives for greater than 90 days of dormancy. Commented Sep 18, 2013 at 23:28