I am trying to find out all the public groups related to an user and display it on a vf page. Is this doable?
Step 1: from Groupmember I get the group Id related to a user using
list<groupmember> g_m = [select id from groupmember where userorgroupid =: userid];
Step 2: I query all the group info
This gives me only a subset of groups of type ="Regular". How do I access all the Public Groups related to a user.
I also want to display the groups that the user is related to as part of nesting (ie) if user A is related to public group A and public group A is nested within Public group B the user becomes part of Public group B to which I want visibility into .
Any help would be greatly appreciated.
Best Answer
that will do the trick. what you basically have to do is to traverse through the nested groups by self referencing the getGroupsForIds() method