The following sample creates a group account record. Also see the section about User Accounts.
// this sample assumes at least one user account record already exists with the unique key (String) value equal to userUniqueKey
protected GroupAccountRepository groupAccountRepository;
private String insertGroupAccount() throws Exception {
String groupAccountName = "administrators";
GroupAccountCreate groupAccount = new GroupAccountCreate();
//uniqueName is a required field
groupAccount.setUniqueName(groupAccountName);
//displayName is a required field
groupAccount.setDisplayName(groupAccountName);
//add users to the group
groupAccount.getUserAccountUniqueKeys().add(userUniqueKeys);
String uniqueKey = groupAccountRepository.insertGroupAccount(groupAccount);
return uniqueKey;
}
private List<String> userAccountUniqueKeys() {
List<String> userUniqueKeys = new List<String>();
userUniqueKeys.add("USER_1005");
userUniqueKeys.add("USER_1009");
userUniqueKeys.add("USER_1041");
return userUniqueKeys;
}