AddUsersToGroup()
An AddUsersToGroup() function adds given users to a chosen group.
Syntax
AddUsersToGroup(userLogin,groupName);
Function arguments
- 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.
Return value
This function returns Boolean.
The AddUsersToGroup() function returns true if the user is added to the group successfully, otherwise false.
Examples
Example 1
This will add a user selected in the „User” field on the form to „Managers” group.
AddUsersToGroup([User],"Managers");
Example 2
This will add specified users with „user1” and „user2” logins to „Managers” group.
AddUsersToGroup("user1;user2","Managers");
Example 3
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");