Choose where you’d like to start

Add records

Note:

  • This task is applicable only to Zoho Creator.

Overview

The add record deluge task creates a new record with given values in the specified form.

Return

This task returns the ID of the created record. It is of NUMBER data type.

Syntax

 <variable>  =  insert into <form_link_name>
 [
     <field_link_name> = <expression>
     <field_link_name> = <expression>
     <field_link_name> = <expression>
 ];
ParameterExplanation

<variable>

(optional)

Variable holding the ID of the new record.

When this param is not specified, the semicolon (;) is not mandatory at the end of the syntax.

<<form_link_name>Link name of the form in which the record will be created.
<field_link_name>

Link name of the field for which the value is specified.

  • All mandatory fields must be specified. All other fields are optional.
  • The system will automatically assign value to the Added User system field based on the login user.
  • Signature, Subform and Add Notes field types cannot be specified
  • Auto Number field type, Formula field type, and System fields such as Added Time, Added location, Added IP Address, Modified Time, Modified location, and Modified IP Address should not be specified. Zoho Creator will set values for them automatically.
<expression>

Value to be assigned to the field. You can directly specify a value, or you can specify an expression, i.e. a combination of values, constants, variables, operators, functions and so on, which evaluates to a value.

Refer this document to know the data type of values each field type can hold.

Things to keep in mind

  • Scripts written in the On Validate and On Success workflow section of the form specified in "Add Record" task will not be executed.
  • If a field is not specified in the "Add Record" task, and that field has "Initial value" property defined, the value will be assigned to that field by default.
  • If "No Duplicate Values" is selected, and a duplicate value is specified in the "Add Record" task, the script execution will fail.

Applicable data type and expression for each field

Field TypeData typePoints to note
NameTEXT

You must specify only the link name of the "Name" field when assigning it a value copied from another "Name" field.

In all other cases, you have to give the values for its sub-fields separately as given below:

<field>.prefix: denotes the "prefix" field.

<field>.first_name: denotes the "first_name" field.

<field>.last_name: denotes the "last_name" field.

<field>.suffix: denotes the "suffix" field.

You can add the above mentioned sub-fields even if they are not selected in the field's property.

Note:

  • If more than one Name fields are present in the form, the link names of the subsequent name sub fields will be appended by a number starting from 1. So, if we take the example of the subfield <field>.prefix, the link name of the first such field will be <field>.prefix, the link name of the second such field will be <field>.prefix1, the link name of the third such field will be <field>.prefix2, and so on.
EmailTEXT

The format of the specified email address must be valid. If the format of the specified email address is invalid, execution will be stopped during runtime.

The number of characters in the value should not exceed the length specified in the "Character maximum" field property. If it exceeds, execution will be stopped during run-time.

AddressTEXT

You must specify only the link name of the "Address" field when assigning it a value copied from another "Address" field.

In all other cases, you have to give values for its sub-fields separately as given below:

<field>.address_line_1: denotes the "Address Line 1" field.

<field>.address_line_2: denotes the "Address Line 2" field.

<field>.district_city: denotes the "City / District" field.

<field>.state_province: denotes the "State / Province" field.

<field>.postal_Code: denotes the "Postal Code" field.

<field>.country: denotes the "Country" field.

<field>.longitude: denotes the "longitude" field.

<field>.latitude: denotes the "latitude" field.

You can add the above mentioned sub-fields even if they are not selected in the field's property.

Note:

  • If more than one address fields are present in the form, the link names of the subsequent address sub fields will be appended by a number starting from 1. So, if we take the example of the subfield <field>.country, the link name of the first such field will be <field>.country, the link name of the second such field will be <field>.country1, the link name of the third such field will be <field>.country2, and so on.
PhoneTEXT

Value can be specified with or without the country code, even if the "Country code options" and "Default country code" field properties are not selected.

Special characters like (), and - are supported to accept different phone number formats of various countries.

Single LineTEXTThe number of characters in the value should not exceed the length specified in the "Character maximum" field property. If it exceeds, execution will be stopped during run-time.
Multi LineTEXTThe value can be plain text of maximum 64 kb size.
NumberNUMBERIf the number of digits specified in the value exceeds the length specified in the "Max Digits" field property, the extra digits will be trimmed from the right.
DateDATE-TIME

All days in a week can be specified as value, irrespective of the selected days in "Allowed Days" property.

Time value, if specified, will not get added.

TimeTIME

Values ranging from 0 to 23 hours will be accepted for 24-hour format. Values ranging from 0 to 12 hours will be accepted for 12-hour format.

Date value, if specified, will not get added.

Drop DownTEXT

You can specify a new choice apart from pre-defined choices even if the "Allow Other Choice" field property is not selected.

If a new choice is specified as the value, it only gets saved in the record and is not added as a new choice to be selected from the form UI. And that choice cannot be retrieved back if modified.

RadioTEXT

You can specify a new choice apart from existing choices even if the "Allow Other Choice" field property is not selected.

If a new choice is specified as the value, it only gets saved in the record and is not added as a new choice to be selected from the form UI. And that choice cannot be retrieved back if modified.

Multi SelectLIST

You can specify a new choice apart from the pre-defined choices.

If a new choice is specified as the value, it only gets saved in the record and is not added as a new choice to be selected from the form UI. And that choice cannot be retrieved back if modified.

CheckboxLIST

You can specify a new choice apart from the pre-defined choices.

If a new choice is specified as the value, it only gets saved in the record and is not added as a new choice to be selected from the form UI. And that choice cannot be retrieved back if modified.

Decision boxBOOLEAN

You can specify the value as True or False, with or without double quotes.

If any other value is specified, execution will be stopped during run time.

Rich TextTEXTThere is no limit to the number or type of characters that can be specified as the value.
URLTEXT

Value can be specified in any of the the following formats:

  • HTML text format: <a href= \"<URL>\" title = \"<TITLE>\" target = \"_blank\"><linkname></a> 
    where: title, link name and target are optional params
     
  • Plain text format: URL as such can be provided as a text enclosed with double quotes.

Note: Plain text format can be used only in the "On success", "On create", "On edit", and "On create or edit" workflow events.

ImageTEXT

Value must be specified in the following format (title, linkname and target are optional params) :

<a href= \"http://<LINKNAME>\" title =\"<TITLE>\" target = \"_blank\"><img src = \"<URL>\" title =\"<TITLE>\"></img></a>

You must specify the image url as the value, even if the "Browse Options -Link" field property is not selected.

The link must be that of a public image.

PercentDECIMAL

If the number of digits specified in the value exceeds the length specified in the "Max Digits" field property, the extra digits will be trimmed from the right.

If the specified decimal points exceed the number specified in "Decimal Points" field property, the extra decimal points will be trimmed from the right. 

CurrencyDECIMAL

If the number of digits specified in the value exceeds the value specified in the "Max Digits" field property, the extra digits will be trimmed from the right.

If the specified decimal points exceed the number specified in "Decimal Points" field property, the extra decimal points will be trimmed from the right. 

DecimalDECIMAL

If the number of digits specified in the value exceeds the value specified in the "Max Digits" field property, the extra digits will be trimmed from the right.

If the specified decimal points exceed the number specified in "Decimal Points" field property, the extra decimal points will be trimmed from the right.

Date-TimeDATE-TIME

All days and hours can be specified as value, irrespective of the selected days and hours in "Allowed Days" and "Allowed Hours" property.

If time value is not specified, 00:00:00 will be set as the time value.

Lookup

(Display type - Dropdown/Radio Button)

NUMBER

You must specify the record ID of the lookup form as the value.

Lookup

(Display type - Multi Select/Checkbox)

LISTYou must specify the record ID of the lookup form as the value.
File UploadFILE UPLOADOnly a file value fetched from another File Upload field type should be specified as a value.
AudioAUDIOOnly an audio file value fetched from another Audio field type should be specified as a value.
VideoVIDEOOnly a video file value fetched from another Video field type should be specified as a value.
UsersTEXT

You can specify username of any user or developer added in your current app.

You can view the list of users and developers in your account by navigating to Settings > Users. From this page, you can also add more users and developers to your account.

If you enter an incorrect username, execution will be stopped during run-time.

Integration (Zoho CRM)TEXT

You must specify the record ID in the selected module as the value. If you enter an incorrect ID, execution will be stopped during run-time.  

Learn how to fetch the ID of a record after creating it or fetching it.

Integration (Zoho Recruit)TEXT

You must specify the record ID in the selected module as the value. If you enter an incorrect ID, execution will be stopped during run-time.

Learn how to fetch the ID of a record after creating it or fetching it.

Integration (Salesforce)TEXT

You must specify the record ID in the selected module as the value. If you enter an incorrect ID, execution will be stopped during run-time.

Learn how to fetch the ID of a record after creating it or fetching it.

Integration (Zoho Books)TEXT

You must specify the record ID in the selected module as the value. If you enter an incorrect ID, execution will be stopped during run-time.

Learn how to fetch the ID of a record after creating it or fetching it.

Integration (Quickbooks)TEXT

You must specify the record ID in the selected module as the value. If you enter an incorrect ID, execution will be stopped during run-time.

Learn how to fetch the ID of a record after creating it or fetching it.

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

Example 1

The following example inserts the defined values in the specified fields:

 insert into Events  // Events is the form link name
 [
     Added_User = zoho.loginuser
     Name.prefix = "Mr"
     Name.first_name = "Harry"
     Name.last_name = "John"
     Name.suffix = "Jr"
     Email = "harry.john@abc.com"
     Address.address_line_12 = "Zoho Corporation"
     Address.address_line_22 = "4141 Hacienda Drive"
     Address.district_city2 = "Pleasanton"
     Address.state_province2 = "California"
     Address.postal_code2 = "94588"
     Address.country2 = "USA"
     Address.longitude2 = "30.219231"
     Address.latitude2 = "-97.750838"
     Phone = "+18778344428"
     Event_name = "Workshops" // Event_name is a single line field type
     Event_details = "Workshops will be held for Zoho Creator as part of a two day program" // Event_details is a multi line field type
     Number_of_attendees = 350 // Number_of_attendees is a number field type
     Date_of_registration = '05-Jul-2018' // Date_of_registration is a date field type 
     Type_of_workshop = "Free" // Type_of_workshop is a drop-down field type
     Event_approval = "Pending" // Project_approval is a radio field type
     Venue = {"USA", "Australia"} // Venue is a multi-select field type
     Required_equipment = {"iPhone", "Macbook", "AppleTV"} // Required_equipment is a checkbox field type
     Read_privacy_policy = True // Read_privacy_policy is a decision field type
     Rich_Text = "Harry John"
     Registration_url = "www.zoho.com/register" // Registration_url is a url field type
     Previous_year_turnout = 99.2 // Previous _year_turnout is a percent field type
     Event_expense = 5000 // Event_expense is a currency field type
     Decimal = 100.4
     Event_start_date = '04-Jul-2018 08:00:00' // Event_start_date is a date-time field type
     Lookup_Dropdown = "1754388000001023025"
     Lookup_Checkbox = {"1754388000001023025", "1754388000001029087"}
     Script = rec.Audio // Script is an audio field type and rec is a fetched record
     Dry_run = rec.Video // Dry_run is a video field type and rec is a fetched record
     Event_emcee = "jameswilliams" // Event_emcee is a users field type
     Zoho_CRM = "00190000010bRIMAA2" // Zoho_CRM is an integration field type
     ];

Example 2

The following example inserts the defined values in the specified fields and returns the ID of the inserted record:

response = insert into Add_Product 
[ 
    Product_Name = "Book" 
    Selling_Price = 150 
    Product_Code = 1120 
    In_Stock = 20 
]; 
info response; //Response 435913XXXXXXX490014

Get Started Now

Execute