Update Records
Table of Contents
Overview
This JS API task updates records displayed in a report of a Zoho Creator application. A maximum of 200 records can be updated per request. The update operation is subject to data validations configured for the corresponding form.
This task is based on the Update Records REST API V2.1. Learn more about understanding the response
Request Details
Syntax
ZOHO.CREATOR.DATA.updateRecords(config).then(function(response){
//callback block
});
Syntax Details
The syntax holds:
- <config> (object) - The configuration required to update records in a report. This configuration includes the following parameters.
Name | Type | Description |
app_name (Optional) | string | Link name of the application that data needs to be pushed to. Retrieve the link name using the Creator report's URL: https://creatorapp.zoho.com/<account_name>/<app_name>/#Report:<report_name> Note: This parameter only needs to be passed when you need to push data in other applications of the same Creator account. When not specified, data will be pushed to the current application. |
report_name | string | Link name of the report in which records need to be updated. Retrieve the link name using the Creator report's URL: https://creatorapp.zoho.com/<account_name>/<app_name>/#Report:<report_name> |
payload | object | Form data supplied in JSON format to update the records with the field values within, 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. |
Payload Parameter
- criteria string
The criteria using which you want to filter the target report.
If all matching records need to be updated, include "criteria": "ID!=0" or "criteria": "ID!=null" in the request. Refer to the Defining the search criteria to learn more.
Criteria is mandated to prevent accidentally updating all matching records. - skip_workflow list
(Optional)
Prevents the associated workflows from being executed on the update of records.
Possible values: form_workflow, schedules, all
Note: By default:
- When more than one type of workflow is mentioned, supply them as comma-separated values in a list. For example,
"skip_workflow" : ["schedules","form_workflow"] - If this parameter is not supplied, all associated workflows will be triggered.
- Blueprints and approvals will be triggered on the update of records and cannot be skipped.
Possible Errors
Refer to this page for the complete list of error codes and messages.
Sample Input
Copiedvar config = {
app_name: "zylker",
report_name: "All-Timesheet",
payload: {
"criteria": "(Single_Line.contains(\"Single Line of Text\"))"
"data": {
"Name": {
"first_name": "James",
"last_name": "Kyle"
}
}
}
};
ZOHO.CREATOR.DATA.updateRecords(config).then(function (response) {
if (response.code == 3000) {
console.log(response);
}
});
Sample Response
Copied{
"result": [
{
"code": 3000,
"data": {
"Number": "12345",
"Single_Line": "Single Line of Text",
"ID": "3888833000000114023"
},
"message": "Data Updated Successfully!",
"tasks": {
"openurl": {
"type": "Same window",
"url": "http://www.zylker.com"
}
}
},
{
"code": 3000,
"data": {
"Number": "12345",
"Single_Line": "Single Line of Text",
"ID": "3888833000000114047"
},
"message": "Data Updated Successfully!",
"tasks": {
"openurl": {
"type": "Same window",
"url": "http://www.zylker.com"
}
}
},
{
"code": 3000,
"data": {
"Number": "12345",
"Single_Line": "Single Line of Text",
"ID": "3888833000000118019"
},
"message": "Data Updated Successfully!",
"tasks": {
"openurl": {
"type": "Same window",
"url": "http://www.zylker.com"
}
}
}
],
"code": 3000
}