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.
int organizationId = 0;
FindGroupsResult result=coreWebService.findGroups(organizationId, locale);
-
Check the result for errors and handle any errors.
if (result.getFindGroupsReturnStatus().getCode() != FindGroupsReturnStatusEnumType.SUCCESS)
{
// handle any errors
}
- Loop through the result until you find the group that you want.
for (Group itr:result.getGroups())
{
if(itr.getLocaleNameAndDescription().getName().equals(groupName)
{
return itr.getGroupId();
}
}
Was this information helpful? Send us your comments.