The add record Deluge task is used in Form action and Field action scripts to insert a new record to a given form with values specified in the expression.
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.
<ID> = insert into <formname>
<fieldname1> = <expression>
<fieldname2> = <expression>
<fieldname3> = <expression>
<formname> - name of the form to insert a new record.
<fieldname> - the name of the field in the form
<ID> - ID value of the inserted record
<expression> - the field value or a deluge expression that returns a value
To add the add record task in Script Builder,
Refer the topic Using Script Builder for steps to add the script.
The sample code given below adds a new record to the expense form based on the values submitted in the payments form. The script is added to the on add -> on success block of the payment form and will be executed when a new record is added to the payment form.
insert into expense
Added_User = zoho.loginuser
Amount = input.amount
Category = input.category
Expense_Date = zoho.currentdate
Payment_method = input.pay_method
Description = "Monthly Payments"
In the above code,