Deluge Help

Update Records in Salesforce

Table of ContentsUp

 Overview

The salesforce.sales.update() task is used to update a record in any of the supported modules in your Salesforce account, directly from your Zoho Creator application. For example, you can update Leads for sales, update Contacts of prospective sales, update Accounts or Campaigns for these sales 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.update(<salesforceConnectionName>, <salesforceModuleName>, <salesforceRecordID>, <params>);

where,
<salesforceResponse> is the map variable returned as response. It contains the details of the updates to be made to the record.
<salesforceConnectionName> refers 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 where the record needs to be updated.
<salesforceRecordID> refers to the ID of the record in Salesforce which needs to be updated.
<params> is the map variable that holds the key,value pairs. The map key is the label name in the format as specified in Salesforce. The map value is the field value as submitted from a Zoho Creator application.

 Example

A sample script to update a record in the Salesforce accounts module is given below. You can execute this script from a Zoho Creator form by adding it to the required Form Actions block. For example, to edit a record in the accounts module, based on the given record ID,

//get ID of the record to be updated
getResponse = salesforce.sales.getRecords("Zoho","SELECT Name,Id FROM Account WHERE Name='John'");
recordListObj = getResponse.get("records");
if (recordListObj != null)
{
recordList = recordListObj.toJSONList();
id = "";
for each recordObj in recordList
{
recmap = recordObj.toMap();
id = recmap.get("Id");
}
if (id != "")
{

//Declare Map Variable to hold the account details
Details = map();

//Add the account details to the map variable
Details.put("AnnualRevenue",1000);
Details.put("Industry","Chemicals");

//updating the account in the Salesforce accounts module with record ID - "id"
SalesforceResponse = salesforce.sales.update("Zoho", "Account", "id", Details);
}
}

Response Format

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

{"done":true}

If the execution fails due to incorrect parameter value,the response will be in the following format:

{
"message":"Cannot deserialize instance of currency from VALUE_STRING value thousand at [line:1, column:2]",
"errorCode":"JSON_PARSER_ERROR"
}

Share this post : FacebookTwitter

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

Write to us: support@zohocreator.com