Deluge Help

Search Records in Salesforce

Table of Contents

 Overview

The salesforce.sales.searchRecords() task is used to search records in any of the supported modules of your Salesforce account, directly from your Zoho Creator Application. For example, you can search records with specific Lead Name, Contact Name or Accounts Name from Salesforce modules like Leads, Contacts, Accounts etc. To connect Zoho Creator with Salesforce, add a new connection from the Setup - Connections page.

 Supported Modules

  • Lead
  • Contact
  • Account
  • Case
  • Solution
  • Product
  • Campaign

 Syntax

<salesforceResponse> = salesforce.sales.searchRecords(<salesforceConnectionName>,<selectQuery>);

where,
<salesforceResponse> is the map variable returned as response. It contains the details of the record that needs to be fetched.
<salesforceConnectionName> refers to the connection name used to connect Zoho Creator with Salesforce. Create a new connection from the Setup - Connections page.
<selectQuery> contains the details of the record that you want to search. It must be in the following format:
select <requiredColumns> from <moduleName> where <attribute name> = <value>. For example, ("SELECT Name,Id FROM Account WHERE Industry='Chemicals'")

 Example

A sample script to search a record from the Salesforce accounts module is given below. You can execute this script from a Zoho Creator form by adding it to the required workflow section​. For example, to search a record from the accounts module, based on the query,

//search record with value of (industry = chemicals) from the Salesforce accounts module
SalesforceResponse = salesforce.sales.searchRecords("Zoho","SELECT Name,Id FROM Account WHERE Industry='Chemicals'");

Response Format

The response returned by Salesforce will be in the format given below:

{"done":true,"records":"[{"Name":"John","Id":"00190000010xPIuAAM","attributes {"type":"Account","url":"/services/data/v20.0/sobjects/Account/00190000010xPIuAAM"}}]"

If the execution fails due to Malformed Query,the response will be in the following format:

{
"message":"\nSELECT * FROM Account where Name='John'\n ^\nERROR at Row:1:Column:7\nunexpected token: '*'",
"errorCode":"MALFORMED_QUERY"
}

Share this post : FacebookTwitter

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

Write to us: support@zohocreator.com