I have to create functionality to automatically add new users to a chatter group and follow it. I'm working from Bob Buzzard's example from here.
I want to have a custom setting store the group names so I can add/remove groups to auto-follow on demand without code changes so I created a list custom setting called "Chatter_Auto_Follow__c" with a custom text field called "Chatter Group".
My problem is that I cannot figure out how to query for a list of the names and then pass that into a CollaborationGroup query for the ids.
Here is a snipit that I'm working with:
// Find the group name from the custom setting Chatter_Auto_Follow__c setting = Chatter_Auto_Follow__c.getall().values(); String groups = setting.Chatter_Group__c; // Find the Chatter group Ids from the names of the custom setting List<CollaborationGroup> chatterGroups = [SELECT id, Name FROM CollaborationGroup WHERE Name in :groups];
When I try to compile I get the error on my collaborationgroup query
IN operator must be used with an iterable expression
What am I doing wrong?