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. To connect Zoho Creator with Salesforce, add a new connection from the Setup - Connections page.

Supported Modules

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

Syntax

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

Below is the description of each parameter,

Param Name Description
<salesforceResponse> It is the map variable returned as response. It contains the details of the record that needs to be fetched.
<salesforceConnectionName> It refers to the connection name used to connect Zoho Creator with Salesforce
<selectQuery> It contains the details of the record that you want to search. It must be in the following format: SELECT from WHERE = . For example, ("SELECT Name,Id FROM Account WHERE Industry='Technology'")

Example

To search a record from the accounts module, based on the query, follow the below steps:

  1. Select the Form from your Dashboard page.
  2. Go to the required Form Actions block.
  3. Add the below script to the editor area.
  4. Click on Save Script to save the script definition.
SalesforceResponse = salesforce.sales.searchRecords("Zoho","SELECT Name,Id FROM Account WHERE Industry='Technology'");

Response Format

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

{"done":true,"records":"[{"Name":"Inteygrate","Id":"00128000013bBMB","attributes {"type":"Account","url":"/services/data/v20.0/sobjects/Account/00128000013bBMB"}}]"

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

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

Using Script Builder

To add the script using the drag-n-drop functionality in Script Builder,

  1. Select the Form from your Dashboard page.
  2. Go to the required Form Actions block.
  3. Click on Scrip Builder from the top-right corner of the page.
  4. Drag and drop the call function in the editor box.
  5. Select Integration tasks.
  6. Select Service as Salesforce.
  7. Select Function as Search Records.
  8. Select the Connection Name to connect with Salesforce. Click on +Create to create a new connection or create a new connection from the Setup - Connections page.
  9. Insert the query to fetch record.
  10. Specify the response variable that will hold the response returned by Salesforce.
  11. Click on Done to insert the call function task.

Search records in Salesforce from Zoho using Script Builder

Upon submission of the form, the specific record gets fetched from Salesforce based on the given query. The response variable will contain the response returned by Salesforce.


You’ve successfully subscribed to inteygrate
Welcome back! You’ve successfully signed in.
Great! You’ve successfully signed up.
Your link has expired
Success! Check your email for magic link to sign-in.