Creator help

Search Records in Zoho CRM

Overview

Fetch records from Zoho CRM by searching based on criteria, using the zoho.crm.searchRecords() task.

Syntax

<response>=zoho.crm.searchRecords(<module_name>, <criteria>, [<page>],[<per_page>]);

where,

Params DescriptionData type

<response> 

is the response returned by Zoho CRM.

LIST

<module_name> 

is the API name of the CRM module where the records will be searched for. 

Following is the list of supported modules.

Leads

Deals

Products

Contacts

Campaigns

Vendors

Accounts

Cases

Quotes

TasksInvoicesCustom Module

Sales_Orders

Purchase_Orders

Calls

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

STRING

<criteria> 

is a conditional statement of the following format: (<colName> : <operator> : <colValue>). The <colName> stands for the CRM field label name and <colValue> stands for its respective value. The <operator>  can contain the following:

  • equals
  • starts_with

Note:

  • If a column contains null values, zoho.crm.searchRecords DOES NOT report them in a <> statement.
 

<page>

  (optional)

To get the list of records based on pages.

Default value: 1.

Bigint

<per_page>

  (optional)

Used to get the list of records available per page.

Default value: 200.

Bigint


Example 1: Search records with a specific email address in a Custom Module

Let's say we need to fetch all records having email address as john@zillum.com from a Custom Module named Hotels. To achieve this, add the following script in the required workflow section of your Zoho Creator Form:

response=zoho.crm.searchRecords("Hotels", "(Email:equals:john@zillum.com)");

where,

response
is the response returned as map by Zoho CRM. The fetched records will be contained in the response.
"Hotels"
is the API name of Zoho CRM Custom Module, of string datatype, where the records will be searched.
"(Email:equals:john@zillum.com)"
is the criteria.

Example 2: Search Accounts which start with a specific letter

Let's say we need to fetch all Accounts which start with the letter "A". To achieve this, add the following script in the required Form Actions block of your Zoho Creator Form:

response=zoho.crm.searchRecords("Accounts", "(Account_Name:starts_with:A)");

where,

response
is the response returned as map by Zoho CRM. The fetched records will be contained in the response.
"Accounts"
is the label name of Zoho CRM Accounts Module, of string datatype, where the records will be searched.
"(Account_Name:starts_with:A)"
is the criteria.

Response Format

The response returned is of the following format:

{  
   "Owner":{  
      "name":"<value>",
      "id":"<value>"
   },
   "<field_api_name>":"<field_value>",
   "Modified_By":{  
      "name":"<value>",
      "id":"<value>"
   },
   },
   "Modified_Time":"<value>",
   "Created_Time":"<value>",
{  

   },
   "Created_By":{  
      "name":"<value>",
      "id":"<value>"
   },
}

Note: It is to be noted that all visible fields in the module will be returned, though we have specified only one line saying "<field_api_name" : "<field_value>" to keep the response format of readable length.

The following is a sample response returned when using the search records task:

{  
   "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
}

Share this post : FacebookTwitter

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

Write to us: support@zohocreator.com