The delete records Deluge task is used in Form action and Field action scripts to delete existing records from a form, based on the specified criteria. The Form definition of the script will be displayed in the Form Definition -> With Action block of the Script Builder, in the format given below. Here, the script is added to the Form Actions - On Add - On Success block of the form.
delete from FormName[ Criteria ];
<formname> - name of the form to delete records <criteria> - The criteria expression/value based on which the records will be deleted.
To add the delete record task in Script Builder,
- Invoke the Script Builder and select the required Form/Field action.
- Drag-n-drop the delete records task from the left-side task tree.
- In the Delete Record dialog, specify the form name and criteria based on which the records must be deleted.
- All the forms in the current application will be listed in the Select Form list-box.
- You can specify your own value as criteria in the <criteria> text area or use the expression builder to add a criteria expression.
Refer the topic Using Script Builder for detailed steps to invoke the script builder and add the script.
The sample code given below deletes all records in the Sample Form whose Email is same as the Email id added to the Contact form. The script is added to the on add -> on success block of the Contact form and will be executed when a new record is added to the Contact form.
delete from Sample[ Email_id == input.Email_id ];