Add records
Table of Contents
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> ];
Parameter | Explanation |
<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.
|
<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 Type | Data type | Points to note |
Name | TEXT | 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:
|
TEXT | 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. | |
Address | TEXT | 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:
|
Phone | TEXT | 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 Line | TEXT | 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. |
Multi Line | TEXT | The value can be plain text of maximum 64 kb size. |
Number | NUMBER | 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. |
Date | DATE-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. |
Time | TIME | 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 Down | TEXT | 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. |
Radio | TEXT | 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 Select | LIST | 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. |
Checkbox | LIST | 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 box | BOOLEAN | 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 Text | TEXT | There is no limit to the number or type of characters that can be specified as the value. |
URL | TEXT | Value can be specified in any of the the following formats:
Note: Plain text format can be used only in the "On success", "On create", "On edit", and "On create or edit" workflow events. |
Image | TEXT | 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. |
Percent | DECIMAL | 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. |
Currency | DECIMAL | 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. |
Decimal | DECIMAL | 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-Time | DATE-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) | LIST | You must specify the record ID of the lookup form as the value. |
File Upload | FILE UPLOAD | Only a file value fetched from another File Upload field type should be specified as a value. |
Audio | AUDIO | Only an audio file value fetched from another Audio field type should be specified as a value. |
Video | VIDEO | Only a video file value fetched from another Video field type should be specified as a value. |
Users | TEXT | 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 Load | Yes | |
On Validate | Yes | |
On Success | Yes | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Created or Edited | ||
On Load | Yes | |
On Validate | Yes | |
On Success | Yes | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Edited | ||
On Load | Yes | |
On Validate | Yes | |
On Success | Yes | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Deleted | ||
On Validate | Yes | |
On Success | Yes | |
Other workflow events | ||
On a scheduled date | Yes | |
During approval process | Yes | |
During payment process | Yes | |
In a Custom Function | Yes | |
In an Action item in report | Yes |
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