The following sample updates an existing group account record by changing the display name, changing the description, and removing an existing group member (user account).
// this sample assumes a group account record already exists with the unique key (String) value equal to uniqueKey
protected GroupAccountRepository groupAccountRepository;
public void test_updateGroupAccount() throws Exception {
GroupAccountUpdate groupUpdate = new GroupAccountUpdate();
//set the uniqueKey with the String value of the target group record to identify which record you are updating
groupUpdate.setUniqueKey(uniqueKey);
//update the existing display name
groupUpdate.setDisplayName("BusinessAdministrators");
//update the existing group description
groupUpdate.setDescription("Administrators who manage Admin Settings and TeamConnect user/group accounts");
//remove a user from the group
groupUpdate.getUserAccountDeleteUniqueKeys().add(userUniqueKeys);
groupAccountRepository.updateGroupAccount(groupUpdate);
}
private List<String> userAccountUniqueKeys() {
List<String> userUniqueKeys = new List<String>();
userUniqueKeys.add("USER_1005");
return userUniqueKeys;
}