Create Record in Zoho People
Table of Contents
Overview
The zoho.people.create task is used to create a record in the specified Zoho People form.
Syntax
<response> = zoho.people.create(<form_name>, <record_values>, [<connection>]);
where:
Params | Data type | Description |
<response> | KEY-VALUE | The ID of the record that will be created and the status of the executed task. |
<form_name> | TEXT | The label name of the form in which the record needs to be created. Note: Click here for the instructions to get the form label names in Zoho People. |
<record_values> | KEY-VALUE | The values of the new record that needs to be created. The keys to this param are the label names of the fields in the specified form. Note: Click here for the instructions to get the field label names. |
<connection> (optional)* | TEXT | The name of the connection. *Note: This param is not applicable to Zoho Creator and mandatory in Zoho Cliq. |
Example
The following script creates a record in the Zoho People form - Employee:
//Create a KEY-VALUE variable to hold the values of the new record values_map = Map(); values_map.put("EmployeeID", "12311"); values_map.put("FirstName", "Richard"); values_map.put("LastName", "Patrick"); values_map.put("EmailID", "richard@zylker.com"); //Execute the Zoho People integration task to create a new record response = zoho.people.create("P_Employee", values_map);
where:
values_map
"EmployeeID" "FirstName" "LastName" "EmailID"
"P_Employee"
Response Format
Success Response
- The success response will be returned in the following format:
{
"result": {
"pkId": "105893000000216001",
"message": "Successfully Added"
}
}
To fetch the ID of the newly created record from the success response obtained, execute the following snippet:
info <response_variable>.get("result").get("pkId");
Failure Response
- The failure response due to duplicate record values will be returned in the following format:
{
"response": {
"message": "Error occurred",
"uri": "/api/forms/json/employee/insertRecord",
"errors": {
"code": 7051,
"message": {
"EmployeeID": "Duplicate value present for EmployeeID "
}
},
"status": 1
}
} - The failure response due to incorrect form name will be returned in the following format:
{
"response": {
"message": "Error occurred",
"uri": "/api/forms/json/test/insertRecord",
"errors": {
"code": 7011,
"message": "Form name 'Test' is invalid"
},
"status": 1
}
}