Add User to a Group
Table of Contents
Note:
- This task is applicable to all services except Zoho Creator.
- Each time the zoho.directory.addUserToGroup integration task is executed, it triggers an API request in the back-end. This call is deducted from the external calls limit available for the service from which the task is executed, based on your pricing plan.
- Only actual executions that receive a response (whether success or failure) are counted, not the number of times the task appears in the script. For example, if zoho.directory.addUserToGroup integration task is placed inside a for each task that iterates five times, the number of external calls consumed will be five, even though the task appears only once in the script.
Overview
The zoho.directory.addUserToGroup task is used to add a user to a specified group in an organization.
Syntax
<response> = zoho.directory.addUserToGroup(<orgID>, <groupID>, <userData>, <connection>);
Scope
ZohoDirectory.Groups.CREATE, ZohoDirectory.Groups.UPDATE
where:
| Parameter | Description | Data type |
| response | is the variable that will hold the details of the user that need to be added to the specified group. | KEY-VALUE |
| <orgID> | is the ID of the organization to which the user needs to be added. | NUMBER |
| <groupID> | is the ID of the group to which the user needs to be added. | NUMBER |
| <userData> | is the variable that will hold the user data like user ID and role to be added. user_id :
member_role :
| KEY-VALUE |
| <connection> | is the name of the Zoho Directory connection. | TEXT |
Example
The following script adds a user with ID - 1510XXXXXXXX to a specified group with ID - 68XXXXXXX in Zoho Directory organization with ID - 72XXXXXXX:
userData = Map(); userData.put("user_id",1510XXXXXXXX); userData.put("member_role", 0); response = zoho.directory.addUserToGroup(72XXXXXXX, 68XXXXXXX ,userData, "zoho_directory_connection")
where:
responseThis is the KEY-VALUEresponse returned by Zoho Directory.
72XXXXXXXThis is the NUMBERthat represents the organization ID of Zoho Directory account.
zoho_directory_connectionThis is the TEXTthat represents the link name of the connection.
68XXXXXXXThis is the NUMBERthat represents the group ID to which the user needs to be added.
"member_role", 0This is the VALUEthat represents the role of user. 0 is for members, and 2 is for moderators.
Response format
{
"status_code": 201,
"members": {
"result": {
"$zgid": {
"failed_userlist": [],
"existing_users": ["1511**********"],
"success_userlist": [],
"updated_users": []
}
},
"href": "https://directory.zoho.com/api/v1/orgs/72*******/groups/68*******/members/1510*********"
},
"resource_name": "members",
"message": "Success"
}
"status_code": 201,
"members": {
"result": {
"$zgid": {
"failed_userlist": [],
"existing_users": ["1511**********"],
"success_userlist": [],
"updated_users": []
}
},
"href": "https://directory.zoho.com/api/v1/orgs/72*******/groups/68*******/members/1510*********"
},
"resource_name": "members",
"message": "Success"
}