Deluge Help

Creating a Record in Salesforce

Table of Contents

 Overview

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

where,
<salesforceResponse> is the map variable returned as response. It contains the details of the newly created 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 where the record is created.
<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 API. The map value is the field value as submitted from a Zoho Creator application.

 Example - To create a record

A sample script to add an account to 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.

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

//Add the account details to the map variable
Details.put("Name","John");
Details.put("BillingCity","Chicago");
Details.put("Type","Prospect");
Details.put("Industry","Chemicals");

//creating the account in the Salesforce accounts module with connection name "Zoho"
salesforceResponse = salesforce.sales.create("Zoho", "Account", Details);

Note

  • In the above example, we have specified the param values directly within quotes. To fetch the param values from a Zoho Creator form, specify the field name used in the form. For example, if Billing_city is the Field Deluge name, the key value pair should be specified in the following format: ("Billingcity", Billing_city)

Response Format

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

{"id":"00190000010xPIuAAM","errors":"[]","success":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