Przejdź do głównej zawartości

AddUsersToGroup()

An AddUsersToGroup() function adds given users to a chosen group.

AddUsersToGroup(userLogin,groupName);
  • userLogin – (String) a login of the user that will be added to the group. Multiple logins can be passed separated by , or ; or as an ObjectList with users logins;
  • groupName – (String) a name of the group to add users to.

This function returns Boolean. The AddUsersToGroup() function returns true if the user is added to the group successfully, otherwise false.

This will add a user selected in the „User” field on the form to „Managers” group.

AddUsersToGroup([User],"Managers");

This will add specified users with „user1” and „user2” logins to „Managers” group.

AddUsersToGroup("user1;user2","Managers");

This will add users selected in „User” field/column in a table named „Users list” on the form to „Managers” group. The object list is used in this example.

usersList=CreateObject("ObjectList");
foreachrow("Users list")
{
AddObjectToList(usersList, [User]);
}
AddUsersToGroup(usersList,"Managers");