Deluge Help

Get Records by ID from Salesforce

Table of Contents

 Overview

The salesforce.sales.getRecordById()task is used to get records from any of the supported modules in your Salesforce account, by specifying the unique ID of the record. For example, you can get a Leads record from the Leads module in Salesforce with the given record ID. To connect Zoho Creator with Salesforce, create a new connection from the Setup - Connections page.

 Supported Modules

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

 Syntax

<salesforceResponse> = salesforce.sales.getRecordById(<salesforceConnectionName>, <salesforceModuleName>, <recordID>);

where,
<salesforceResponse> is the map variable returned by Salesforce as response. It contains the details of the fetched record.
<salesforceConnectionName> referes to the connection name used to connect Zoho Creator with Salesforce. Create a new connection from the Setup - Connections page.
<salesforceModuleName> refers to the module name in Salesforce from where the record is fetched.
<recordID>is the ID of the record in Salesforce that needs to be fetched.

 Example

A sample script to get a record from the Salesforce Accounts module with a given record ID is given below. You can execute this script from a Zoho Creator form by adding it to the required workflow section. For example, to fetch a record from the accounts module, based on the recordID,

salesforceResonse = salesforce.sales.getRecordById("Zoho", "Account", "00190000010bRIMAA2");
//returns a list of records with recordID = "00190000010bRIMAA2"

 Response Format

The response returned by Quickbooks will be in the format given below.

{ "UpsellOpportunity__c":null,
"ParentId":null,
"Phone":null,
"TickerSymbol":null,
"SLAExpirationDate__c":null,
"Type":null,
"OwnerId":"00590000002l9KTAAY",
"LastModifiedDate":"2014-08-06T09:58:31.000+0000",
"ShippingState":null,
"AnnualRevenue":1000,
"BillingState":null,
"NumberofLocations__c":null,
"LastActivityDate":null,
"NumberOfEmployees":null,
"BillingPostalCode":null,
"SLASerialNumber__c":null,
"SystemModstamp":"2014-08-06T09:58:31.000+0000",
"ShippingCity":null,
"Description":null,
"BillingCountry":null,
"Site":null,
"ShippingCountry":null,
"LastModifiedById":"00590000002l9KTAAY",
"Website":null,
"ShippingStreet":null,
"AccountNumber":null,
"Fax":null,
"BillingStreet":null,
"SLA__c":null,
"Active__c":null,
"CustomerPriority__c":null,
"MasterRecordId":null,
"Name":"feb",
"BillingCity":null,
"Rating":null,
"CreatedById":"00590000002l9KTAAY",
"CreatedDate":"2014-08-06T09:58:31.000+0000",
"IsDeleted":false,
"Id":"00190000010xPIuAAM",
"Ownership":null,
"attributes":"{" type":"Account",
"url":"/services/data/v20.0/sobjects/Account/00190000010xPIuAAM"
}","ShippingPostalCode":null,
"Sic":null,
"Industry":"Chemicals"
}

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