Site Home  »   Statements »  Data Access »  Add Record

Add Record

Tags:  


Description

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.

Syntax

  on  add
{
on success
{
<ID> = insert into <formname>
[
<fieldname1> = <expression>
<fieldname2> = <expression>
<fieldname3> = <expression>
];

}
}

where,

<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


Using Script Builder

To add the add record task in Script Builder,

  1. Select the Form/Field action.
  2. Drag-n-drop the add record task from the left-side task tree.
  3. Click on Edit to specify the form name, field names and value in the Edit dialog. 
         
    • All the forms in the current application will be listed in the Select Form list-box.
    • To specify field values, the Deluge expression builder can be invoked for each field by selecting the "Write Expression" button. 
       
  4. Click Done to update the values.

 

Example

The sample code given below adds a new record in the form named "Sample" with fields named Added_User, EmailId and Name. 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.

form  Contact
{

Name
(
type = text
)

EmailId
(
displayname = "Email 1"
type = email
)

actions
{
on add
{

Submit
(
type = submit
on success
{
insert into Sample2
[
Added_User = zoho.loginuser
Email_1 = input.Email_1
Name = input.Name
];
}

)
Reset
(
type = reset
displayname = "Reset"
)
}

}
}

Related Links

Tips & Tricks -> Add Record using Add Record Task

 




 RSS of this page