Get Records by Id from Zoho CRM

Get Records by Id from Zoho CRM

Overview

Fetch a record from Zoho CRM by simply specifying the record id, using zoho.crm.getRecordById() task in Zoho Creator.

Syntax

<response> =zoho.crm.getRecordById(<module_name>, <record_ID>);

where,

Params DescriptionData type

<response> 

is the response returned by Zoho CRM.

MAP

<module_name> 

is the API name of the CRM module from where the records will be fetched. 

Following is the list of supported modules.

Leads

Potentials

Products

Contacts

Campaigns

Vendors

Accounts

Cases

Quotes

Sales_Orders

Purchase_Orders

Invoices

Note: Refer this for the instructions to get API names of the CRM modules and fields.

STRING

<record_Id>

is the id the record that needs to be fetched.

BIGINT

Example: Fetch a Lead record by specifying its id

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

  • Lead_ID (Zoho CRM Leads field type)
  • Lead Owner (Single Line field type)

Add the following script in Field Actions > Lead_ID > On User Input to fetch Lead Owner of the specified Lead ID and set it as a Form field value:

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

input.Lead_Owner= response.get("Owner").get("name") ;

where,

response
is the map returned as map by Zoho CRM containing the details of the specified Lead.
"Leads"
stands for the Leads module, of string datatype.
input.Lead_ID 
input.Lead_Owner
refers to the Form fields input.
"Owner"
is the API name of Zoho CRM field, of string datatype.

Response Format

The response returned is of the following format:

{  
   "Owner":{  
      "name":"Ben",
      "id":"2938383000000132011"
   },
   "Company":"Zillum",
   "Email":"bruce.wills@zillum.com",
   "Description":null,
   "Discount":null,
   "$currency_symbol":"$",
   "Total_Amount":null,
   "Rating":null,
   "Website":null,
   "Twitter":null,
   "Salutation":null,
   "Last_Activity_Time":null,
   "First_Name":null,
   "Full_Name":"Wills",
   "Lead_Status":null,
   "Industry":null,
   "Modified_By":{  
      "name":"Ben",
      "id":"2938383000000132011"
   },
   "Skype_ID":null,
   "$converted":false,
   "$process_flow":false,
   "Phone":"+1 678 904 1854",
   "Street":null,
   "Zip_Code":null,
   "id":"2938383000000399001",
   "Email_Opt_Out":false,
   "$approved":true,
   "Designation":null,
   "$approval":{  
      "delegate":false,
      "approve":false,
      "reject":false,
      "resubmit":false
   },
   "Modified_Time":"2018-03-28T11:34:40+05:30",
   "Created_Time":"2018-03-28T11:34:40+05:30",
   "$converted_detail":{  

   },
   "$followed":false,
   "$editable":true,
   "City":null,
   "No_of_Employees":0,
   "Mobile":null,
   "Last_Name":"Wills",
   "State":null,
   "Total":0,
   "Lead_Source":null,
   "Country":"United States",
   "Tag":[  

   ],
   "Created_By":{  
      "name":"Ben",
      "id":"2938383000000132011"
   },
   "Fax":null,
   "Annual_Revenue":0,
   "Secondary_Email":null
}

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().

Share this post : FacebookTwitter

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

Write to us: support@zohocreator.com