Search Records in Salesforce
Table of Contents
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.
<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'")
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'");
The response returned by Salesforce will be in the format given below:
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: '*'",