Retrieve group IDs
To find all groups in an organization, you can use the
findGroups() method.
Before you begin: Retrieve the groupName string for the name of the group in the locale that you are using.
-
Invoke findGroups().
By default, all groups use organizationId = 0. To retrieve a group that uses different organization ID specify the organizationId integer for the organization.
FindGroups request = new findGroups();
request.organizationId = 0;
request.locale = locale;
FindGroups.response = coreWebService.findGroups(request);
FindGroups.result = response.returnValue;
-
Check the result for errors and handle any errors.
if (result.findGroupsReturnStatus.code != FindGroupsReturnStatusEnumType.SUCCESS)
{
// handle any errors
}
- Loop through the result until you find the group that you want.
for (int i=0;i< result.groups[i].Length;i++)
{
if(result.groups[i].localeNameAndDescription[0].equals(groupName)
{
return result.groups[i].groupId;
}
}
Was this information helpful? Send us your comments.