Add Records
Table of Contents
Overview
This JS API task adds one or more records to a form in your Zoho Creator application. Subject to data validations, each JSON object in the payload will be added as a record. A maximum of 200 records can be created per request.
This V1 task is based on the Add Records REST API V2. Learn more about understanding the response
Request Details
Syntax
ZOHO.CREATOR.API.addRecord(config).then(function(response){
//callback block
});
Syntax Details
The syntax holds:
- <config> (object) - The configuration required to add a record. This configuration includes the following parameters.
Name | Type | Description |
appName (Optional) | string | Link name of the application to which data needs to be pushed. Retrieve the link name using the Creator form's URL: https://creatorapp.zoho.com/<accountName>/<appName>/#Form:<formName> Note: This parameter has to be passed only when you need to push data into other applications of the same Creator account. When not specified, data will be pushed to current application. |
formName | string | Link name of the form to which the records need to be added. Retrieve the link name using the Creator form's URL: https://creatorapp.zoho.com/<accountName>/<appName>/#Form:<formName> |
data | object | Form data supplied in JSON format, to include records in the form. The field link names necessary for the key-value pairs can be obtained from the field properties in form builder. Refer to the Setting Field Values section to learn more about the format. |
Possible Errors
Refer to this page for the complete list of error codes and messages.
Sample Input
CopiedformData = {
"data" : {
"Name": {
"first_name": "James",
"last_name": "Kyle",
},
"Address": {
"address_line_1": "Dari Mart",
"address_line_2": "Hayden Bridge Rd",
"district_city" : "Springfield",
"state_province" : "Oregon",
"postal_code" : "97477",
"country" : "United States"
},
"Rich_Text" : "The phone number is <b>+1541-726-4051</b>",
"Phone_Number": "+15417264051",
"Single_Line": "A simple one line text",
"Email": " james@zylker.com ",
"Dropdown" : "Open",
"Radio" : "Closed",
"Multi_Select" : ["New", "Used"],
"Checkbox" : ["Refurbished", "Used"],
"Number": "1000",
"Decimal" : "1000.00",
"Percent": "60.00",
"Date_field" : "10-Jan-2020",
"Date_Time" : "23-Mar-2020 12:25:43 PM",
"Ur1": {
"value": "Dari Mart",
"url": " www.darimart.com",
"title": "Dari mart provisional store"
},
"Lookup_Single_Select" : "521270000078464",
"Lookup_Multi_Select" : ["5212750000247932","5212750000564867"],
"SubForm" : [
{
"Single_Line" : "Service Equipment",
"Dropdown" : "New Order"
},
{
"Single_Line" : "Rotary Machine",
"Dropdown" : "Replacement",
}
]
}
}
var config = {
appName : "zylker",
formName : "timesheet",
data : formData
}
ZOHO.CREATOR.API.addRecord(config).then(function(response){
if(response.code == 3000){
console.log("Record added successfully");
}
});
Sample Response
Copiedresponse = {
"code": 3000,
"data": {
"ID": "2000000245119"
},
"message": "success"
}