Update Records in SkyDesk CRM

Overview

SkyDesk Creator and SkyDesk CRM have been integrated for efficient usability purposes. We have developed tasks in SkyDesk Creator to perform automatic actions in SkyDesk CRM, which would otherwise require manual execution. For example, you can update records in SkyDesk CRM by simply submitting a Form with relevant details in SkyDesk Creator.  This can be achieved using zoho.crm.updateRecord() task in SkyDesk Creator.

Use Case Scenario

Let's say we have a SkyDesk Creator Form which stores Leads information. To update existing Lead details in SkyDesk CRM you can execute the zoho.crm.updateRecord() task. The specified record is updated when the Form is submitted with updated information. Further details on how to execute this task are explained below.

Syntax

<response> =zoho.crm.updateRecord(<module_name>, <record_ID>, <New values as map object>);

where,

Params  Description

<response> 

is the response returned as MAP by SkyDesk CRM.

<module_Name> 

is the name of the CRM module, of STRING datatype, where the records will be updated. Following is the list of supported modules.

Leads

Potentials

Products

Contacts

Campaigns

Vendors

Accounts

Cases

Quotes

Sales Orders

Purchase Orders

Invoices

<record_Id>

is the record id, of NUMBER datatype, that needs to be updated.

<New values as map object>

key, value pairs with updated values 

Example 1: Update a Lead record by specifying it's id

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

  • Lead(SkyDesk CRM Leads field type)
  • Company Name (SkyDesk CRM Leads field type)
  • Name (Single Line field type)
  • Telephone (Number field type)
  • Email Address (Email field type)

Add the following script in On Add > On Success to update details of the specified Lead id.

leadinfo = {"Company":input.Company_Name, "Last Name":input.Name, "Phone":input.Telephone, 
"Email":input.Email_Address}; 

response = zoho.crm.updateRecord("Leads",input.Lead_ID,leadinfo);

where,

leadinfo
contains key values pairs, where the keys are SkyDesk CRM label names and values are updated field inputs.
response
is the response returned as   map  by SkyDesk CRM. The fetched records will be contained in the response. Check sample response here.
"Leads"
is the label name of SkyDesk CRM Leads Module, of string datatype, where the records will be updated.
input.Lead_ID
refers to the Form field(Lead) input.

Example 2: Update a Quote with Product details by specifying the Quote ID

Let's assume we have a SkyDesk Creator Form used to store Quotes and its Products details. The Form consists of the following fields:

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

Add the following script in On Add > On Success section of your Form to update an existing Quotes record:

quoteDetails = map(); 
quoteDetails.put("Subject", input.Subject); 
quoteDetails.put("ACCOUNTID", input.Account_ID); 
productsList = List:Map(); 
 
for each product in input.Product_Details 
{ 
Product_Details = map(); 
Product_Details.put("Product Id", product.Product_ID); 
Product_Details.put("Quantity", product.Quantity); 
productsList.add(productDetails); 
} 
quoteDetails.put("Products", productsList); 

response = zoho.crm.updateRecord("Quotes", QuotesID, quoteDetails);

where,

quoteDetailsproductDetails
is the response returned as   map  by SkyDesk CRM. The fetched records will be contained in the response. Check sample response here.
"Subject" 
"ACCOUNTID" 
"Product Id" 
"Quantity" 
"Products"
are SkyDesk CRM field labels ,  of  string  datatype
input.Subject 
input.ACCOUNT_ID
are SkyDesk Creator field inputs.
input.Product_Details
is Subform field input.
product
stands for each subform entry or record.
product.Product_ID 
product.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  datatype , where the record will be updated.
response
is response returned as   map  by SkyDesk CRM. Check sample response here.

Example 3: Update Attachment in an Account

Let's assume we have a Form with a File Upload field. To update an attachment in SkyDesk CRM's Accounts module, add the following script in On Add > On Success section of the Form:

response = zoho.crm.attachFile(("Accounts"), 1560679000000413019, input.File_Upload);

where,

response
is the response returned as map  by SkyDesk CRM. Check sample response here
response
is the response returned as   map  by SkyDesk CRM. The fetched records will be contained in the response. Check sample response here.
"Accounts"
stands for the Accounts module in SkyDesk CRM ,  of  string datatype.
1560679000000413019
is the ID of the record in Accounts module where the attachment is to be updated.
input.File_Upload
refers to the input value of File Upload field in the Form.

Response Format

The response returned is of the following format:

{"message":"Record(s) updated successfully","Created Time":"2016-03-17 12:35:00","Modified By":"Creator Support Test","Id":"1560679000000413009","Modified Time":"2016-03-28 12:37:44","Created By":"Creator Support Test"}

 

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.updateRecord() 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()
  • To convert the json string to list format, use toJSONList().