Choose where you’d like to start

Delete records

Note: This task is applicable only to Zoho Creator.

Overview

The delete record deluge task deletes a form's records which meet a given criteria.

The criteria is mandatory.

Syntax

delete from <form_link_name> [<criteria>];

ParameterDescription
<form_link_name>

Link name of the form from which the records will be deleted.

<criteria>

Criteria based on which the records will be deleted.

Things to keep in mind

  • Deleting a child form's record added as a subform entry from a parent form, will empty that subform entry in the parent form as well, even if the subform field is marked as mandatory.
  • Deleting a parent form record only delinks the subform fields connected to the parent form record. In order to delete all the linked subform records when a parent form record is deleted, use Delete records task on Delete on validation workflow of the parent form. (Refer Example 4)
  • Deleting a record in a lookup form will empty the corresponding lookup field's value in the related form, even if the lookup field is marked as mandatory.
  • If you wish to delete all records in the specified form, use the following script as criteria:
    [ID != 0]

    It is advisable to fetch all records only when absolutely needed. Fetching all records generates a load resulting in performance issues.

This task can be used in the following events

When a record is Created
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Created or Edited
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Edited
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Deleted
On ValidateYes
On SuccessYes
Other workflow events
On a scheduled dateYes
During approval processYes
During payment processYes
In a Custom FunctionYes
In an Action item in reportYes

Examples

  1. The following script deletes all records with "Status" field value as "Resigned".

     delete from Employees[Status == "Resigned"];	
  2. The following script deletes all records of members who are above 65 years of age. 

     delete from Employee[DOB <= zoho.currentDate.subYear(65)];
     //subYear is a which subtracts given number of years, which in this case is 65.
     //zoho.currentDate is a which holds current(today) date value.
    
  3. The following script deletes all records which have null value for "Name" field.

    delete from Employee[Name == null];  
    
  4. The following script deletes all suform records linked to the current parent form record.

    Note: Write this script in On Delete On Validate workflow event of parent form to delete all the linked subform records whenever a parent form record is deleted.
     
     subforms_ids = parentForm_linkname[ID == input.ID].subForm_fieldname; 
     for each sub in subforms_ids 
     { 
     delete from subForm_linkname[ID == sub]; 
     } 
    

Get Started Now

Execute