Delete Records

Table of Contents

Overview

This JS API task deletes the records displayed by a report of your Zoho Creator application. It is deleted from the stored form and hence will not be available anywhere in the application. The delete request is subject to custom validations configured for the target form. The maximum of 200 records can be deleted for every API call. If exceeded, and you will receive an error.

This task is based on the Delete Records  REST API V2.1. Learn more about understanding the response

Request Details

Syntax

ZOHO.CREATOR.DATA.deleteRecords(config).then(function(response){
   //callback block
});

Syntax Details

The syntax holds:

  • <config> (object) - The configuration required to delete records in a report. This configuration includes the following parameters.
NameTypeDescription
app_name
(Optional)
string

Link name of the application in which records need to be deleted. 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 delete records in other applications of the same Creator account. When not specified, records will be deleted from the current application.
report_namestringLink name of the report in which the records need to be deleted. Retrieve the link name using the Creator report's URL: https://creatorapp.zoho.com/<account_name>/<app_name>/#Report:<report_name>
process_until_limit
(Optional)
string

When the number of matching records exceeds the maximum count of 200, your request will fail. 

To avoid this, include this parameter in your request which deletes the first 200 records and returns the more_records key in the response. 
Eg. process_until_limit=true provides the more_records key if deemed necessary.

more_records
(Optional)
stringEvery time records exist beyond the maximum delete count (200), a unique key will be received in the response. This can be added in the next API call to delete the consecutive batch of 200 records if they exist.
payloadobjectSpecific parameters supplied in JSON format perform actions upon successful deletion of records.

Payload Parameter

  • criteria string
    The criteria using which you want to filter the target report. Criteria is mandated to prevent you from accidentally deleting all matching records.

    If you're looking to delete all matching records, you'll have to include "criteria": "ID!=0" or "criteria": "ID!=null" in your request. Refer to the Defining the search criteria section to learn more.

  • skip_workflow (Optional)
    list
    Prevents the associated workflows from being executed when the records are deleted.
    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 will be triggered when the records are deleted 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: "(Status == \"Invalid\" && Date '01-01-2019')"
    }
};
ZOHO.CREATOR.DATA.deleteRecords(config).then(function (response) {
  if (response.code == 3000) {
    console.log(response);
  }
});

Sample Response

Copiedresponse = {
   "result": [{
       "code": 3000,
       "data": {
         "ID": "66359000000021016"
       },
       "message": "success"
     },
     {
       "code": 3000,
       "data": {
         "ID": "66359000000024309"
       },
       "message": "success"
     }
   ],
 "code": 3000
}