The salesforce.sales.getRecords() task is used to fetch records from any of the supported modules in your Salesforce account, to 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

Syntax

<salesforceResponse> = salesforce.sales.getRecords(
                     <salesforceConnectionName>, 
                     <salesforceModuleName>, 
                     <criteria>, 
                     <ColumnsToBeSelected>
);

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.
<salesforceModuleName> It refers to the module name in Salesforce where the record is created
<criteria> It is the optional parameter based on which the records wll be fetched. The criteria must be in the format = . For example, "Name = 'Inteygrate'"
<columnsToBeSelected> It is the optional parameter which specifies the name of the attributes to be selected.

Example - Fetch Records

To fetch a record from the accounts module, 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.
"Accounts" module
SalesforceResponse = salesforce.sales.getRecords("CRM", "Account");

SalesforceResponse = salesforce.sales.getRecords("CRM", "Account","Name = 'Inteygrate'");

fieldList = List();
fieldList.add("Name");
fieldList.add("Id");
fieldList.add("Industry");
SalesforceResponse = salesforce.sales.getRecords("CRM", "Account", "Name = 'Inteygrate'",fieldList);

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\"},\"Industry\":\"Technology\"}]",
"totalSize":1
}

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

##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 Get 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. Select the module name in Salesforce, from where you need to fetch the record.
  10. Specify the criteria based on which the records will be fetched. This is an optional parameter.
  11. Specify the columns to be fetched. This is an optional parameter.
  12. Specify the response variable that will hold the response returned by Salesforce.
  13. Click on Done to insert the call function task.

Fetch records using Script Builder

Upon submission of the form, the specific record gets fetched from Salesforce based on the given module name and criteria. 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.