Deluge Help

Create Records in Zoho CRM

Overview

Zoho Creator and Zoho CRM have been integrated for efficient usability purposes. We have developed integration tasks in Zoho Creator to perform automatic actions in Zoho CRM, which would otherwise require manual execution. Lets take the example of creating records. You can add a record in Zoho Creator form(by submitting the form) and have it simultaneously added in Zoho CRM without re-entering data for the second time in CRM. This can be achieved by using zoho.crm.create() task in Zoho Creator.

Use Case Scenario

Let's say we have a Zoho Creator sign-up form which is submitted by users to initiate their interest/probe for a particular product. To create a Lead simultaneously in our Zoho CRM’s "Leads" module, you can execute zoho.crm.create() task in the "On Success" form actions block of the Creator form. This will create a record in Zoho CRM with relevant details whenever the form is submitted. Further details on how to execute this task are explained below.

Syntax

<variable>=zoho.crm.create(<module_name>,<field_values>,[<duplicate_check>]);

where,

ParamsDescription

<variable>

is the response returned as MAP by Zoho CRM.

<module_name>

is the name of the CRM module, of STRING datatype, where the record will be added. For example, "Leads" refers to the Leads module. Following is the list of supported modules.

Leads

Potentials

Products

Contacts

Campaigns

Vendors

Accounts

Cases

Quotes

Sales Orders

Purchase Orders

Invoices

<field_values>

is the MAP variable that holds the key,value pairs. The map key is the label name as specified in the CRM module and the map value is the field value as submitted in the ZC form.

For example, "Company" : input.Company_Name . Here, "Company" is the label name as specified in the CRM module and input.Company_Name refers to the value specified in the Company_Name field in the Zoho Creator form.

<duplicate_check>

(optional)

is ofNUMBERdatatype. The following table represents the duplicate check values and it's description.

ValueDescription

1

Checks for duplicate records in CRM and throws an error response, if found.

2

Checks for duplicate records in CRM and updates the same, if found.

0

Duplicate check is not peformed.

Example 1: Creating a Lead in Zoho CRM

Let’s take an example of creating a Lead in Zoho CRM by submitting a form in Zoho Creator. Assume we have a Creator form, containing fields:

  • Name (Single Line field type)
  • Company Name (Single Line field type)
  • Phone (Number field type)
  • Email Address (Email field type)
  • PO Box (Number field type)
  • Country (Single Line field type)

The form is used to record details of a potential customer who is interested in buying a product. To create this record simultaneously in Zoho CRM LEAD module, add the following script in the  On Success workflow section of the form.

leadinfo = {"Company":input.Company_Name,"Last Name":input.Last_Name,"Phone":input.Phone,"Email":input.Email_Address,"PO Box":input.PO_Box,"Country":input.Country};

response = zoho.crm.create("Leads",leadinfo);

where,

leadinfo
is a map variable that holds the key value pairs.
"Company""Last Name""Phone""Email""PO Box""Country"
are Zoho CRM field labels of string type.
input.Company_Nameinput.Nameinput.Telephoneinput.Email_Addressinput.PO_Boxinput.Country
are Zoho Creator field inputs.
"Leads"
is the CRM module, of string type, where the record will be created.
response
is response returned as map by Zoho CRM. Check sample response here.

Note: The following modules follow a similar process of creating records, as explained in the above example:

  • Leads
  • Potentials
  • Products
  • Accounts
  • Contacts
  • Campaigns
  • Vendors
  • Cases

Example 2: Creating a Quote with Account Name, Products list and Subject

Let’s take an example of creating a Quote (containing Account Name, Products list and Subject) in Zoho CRM, by submitting a form in Zoho Creator. Assume we have a Zoho Creator form with fields:

  • CRM Account (Zoho CRM Accounts field type)
  • Subject (Single Line field type)
  • Product Details (Subform field type)containing CRM Product (Zoho CRM Products field type) and Quantity (Number field type)fields.

While submitting the form, to create the quote simultaneously in Zoho CRM Quotes module, add the following script in On Success workflow section of the Creator Form and click on Save.

quoteDetails=Map();quoteDetails.put("Subject",input.Subject_field);quoteDetails.put("ACCOUNTID",input.CRM_ACCOUNT_ID);productsList=List:Map();for eachproductininput.Product_Details{productDetails=Map();productDetails.put("Product Id",product.CRM_PRODUCT_ID);productDetails.put("Quantity",product.Quantity);productsList.add(productDetails);}quoteDetails.put("Products",productsList);
response=zoho.crm.create("Quotes",quoteDetails);

where,

quoteDetailsproductDetails
are map variables that hold the key value pairs.
"Subject""ACCOUNTID""Product Id""Quantity""Products"
are Zoho CRM field labels of string type.
input.Subject_fieldinput.CRM_ACCOUNT_IDinput.Email_Address
are Zoho Creator field inputs.
input.Product_Details
is Subform field input.
product
stands for each subform entry or record.
product.CRM_Product_IDproduct.Quantity
are unique Subform field inputs for each Subform entry or record.
productsList
is a list variable containing map values of subform field inputs.
"Quotes"
is the CRM module, of string type, where the record will be created.
response
is response returned as map by Zoho CRM. Check sample response here.

Note: The following modules follow a similar process of creating records, as explained in the above example:

  • Quotes
  • Sales Orders
  • Purchase Orders
  • Invoices

Example 3: Upload an attachment to Zoho CRM

Let's say we have a Zoho Creator form to store Leads which contains, among other field types, a file-upload field type. The label name for attachment in CRM is Attachment in both syntax and response. To upload an attachment in CRM, the following script can be added to On Success workflow section.

leadinfo={"Company":input.Company,"Last Name":input.Name,"Email":input.Email,"Attachment":input.File_upload};

response=zoho.crm.create("Leads",leadinfo);

where,

leadinfo
is a map variable that holds the key value pairs.
"Company""Last Name""Email""Attachment"
are Zoho CRM field labels of string type.
input.Companyinput.Nameinput.Emailinput.File_upload
are Zoho Creator field inputs.
"Leads"
is the CRM module, of string type, where the record containing the attachment
will be created.
response
is response returned as map by Zoho CRM. Check sample response here.

Example 4: Create a Task in CRM with Contact and Account lookup

Let's assume we have a Zoho Creator Form with the following fields:

  • Owner Name (Single Line field type)
  • Owner ID (Number field type)
  • Subject (Single Line field type)
  • Description (Multi Line field type)
  • CRM Account (Zoho CRM Accounts field type)
  • CRM Contact (Zoho CRM Contacts field type)

To create a Task in CRM, add the following script in the On Success workflow section of the form:

taskInfo={"Task Owner":input.Owner_Name,"Subject":input.Subject,"Description":input.Description,"SEMODULE":"Accounts","SEID":input.CRM_Account_ID,"CONTACTID":input.CRM_Contact_ID};

response=zoho.crm.create("Tasks",taskInfo);

where,

taskinfo
is a map variable that holds the key value pairs.
"Task Owner""Subject""Description""SEMODULE""SEID""CONTACTID"
are Zoho CRM field labels of string type.
input.Owner_Nameinput.Subjectinput.Descriptioninput.CRM_Account_IDinput.CRM_Contact_ID
are Zoho Creator field inputs.
"Accounts"
stands for the module, of string type, to which the task will be attached. In this
case it is "Accounts".
"Tasks"
is the CRM module, of string type, where the record will be created.
response
is response returned as map by Zoho CRM. Check sample response here.

Example 5 : Adding notes to a Lead

Let's say we have a Creator form with the following fields:

  • CRM Lead (Zoho CRM Leads field type)
  • Note Title (Single Line field type)
  • Note Description (Multi Line field type)

Add the following script in the On Success workflow section of the form to attach Notes to the specified lead:

notesMap={"entityId":input.Zoho_Lead_ID, "Note Title":input.Note_Title,"Note Content":input.Note_Description};

response=zoho.crm.create("Notes",notesMap);

where,

notesMap
is a map variable that holds the key value pairs.
"entityId""Note Title""Note Content"
are Zoho CRM field labels of string type.
input.Zoho_Lead_IDinput.Note_titleinput.Note_Description
are Zoho Creator field inputs.
"Notes"
is the CRM module, of string type, where the record will be created.
response
is response returned as map by Zoho CRM. Check sample response here.

Example 6 : Create an Event

Let's assume we have a Zoho Creator Form with the following fields:

  • Subject (Single Line field type)
  • Event StartTime (Date-Time field type)
  • Event EndTime (Date-Time field type)

To create a record in the Events module with the Form input values, add the following script in On Success workflow section of the form:

eventinfo={"Subject":input.Subject,"Start DateTime":input.Event_StartTime,"End DateTime":input.Event_EndTime };

response=zoho.crm.create("Events",eventinfo);

where,

eventinfo
is a map variable that holds key value pairs.
"Subject""Start Date Time""End Date Time"
are Zoho CRM field labels of string type.
input.Subjectinput.Event_StartTimeinput.Event_EndTime
are Zoho Creator field inputs
"Events"
is Zoho CRM module of string type.
response
is response returned as map by Zoho CRM. Check sample response here.

Note: The date-time values selected in Zoho Creator are rendered the same in Zoho CRM irrespective of their configured date-time formats.

Example 7 : Create records in a Custom Module

Assume we have a Zoho Creator Form and a Custom Module in Zoho CRM, both consisting of the following fields:

  • Name (Single Line field type)
  • Phone(Number field type)
  • Email (Email field type)

To create a record in a Custom Module with the Form input values, add the following script in On Success workflow section of the form:

custominfo={"Name":input.Name,"Phone":input.Phone,"Email":input.Email };

response=zoho.crm.create("CustomModule1",custominfo);

where,

custominfo
is a map variable that holds the key value pairs.
"Name""Phone""Email"
are Zoho CRM field labels of string type.
input.Nameinput.Phoneinput.Email
are Zoho Creator field inputs
"CustomModule1"
is the label name of Zoho CRM Custom Module, of string type. The URL
of Zoho CRM Custom Module can be used to retrieve the Custom Module label name.
For example - https://crm.zoho.com/crm/CreateEntity.do?module=CustomModule1
response
is response returned as map by Zoho CRM. Check sample response here.

Note: Custom Modules are by default named as CustomModuleX (where X is a number). Specify the same Custom Module name format in the syntax. The URL of Zoho CRM Custom Module can be used to retrieve the Custom Module label name. For example - https://crm.zoho.com/crm/CreateEntity.do?module=CustomModule1

Response Format

The response returned is of the following format:

{

"message":"Record(s) added successfully",
"Created Time":"2011-06-14 12:28:11",
"Modified By":"ZohoTest",
"Id":"1584000000028003",

"Modified Time":"2011-06-14 12:28:11",
"Created By":"ZohoTest"

}

To get the ID of the newly created record, execute the following script:

currentid=response.get("Id").toLong();

If record creation fails due to any reason, a failure response of the following format is returned. To know more about error codes, click here.

{

"message":"No CRM account",
"code":"4102"

}

Limitation

CRM Tasks can be executed only in accounts which are under Flexible and Unlimited Plans. Accounts under Free Plan, kindly upgrade to use CRM tasks. For more details scroll down to Integration and Web Data on the pricing page.

Script Builder

You can also make use of Script builder to define the zoho.crm.create() task. Navigate to your application’s Workflow and drag and drop the Call Function under Deluge Tasks > Miscellaneous. Select Integration tasks and fill out necessary information.

Related Links

  • To fetch the string value to which the specified key is mapped, use get()
  • To get values from fetched records, use getJSON()

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohocreator.com