Create record

Create record in Salesforce

Note: This task is applicable only to Zoho Creator.

Overview

Create a record in Salesforce using this task.

Syntax

<variable> = salesforce.sales.create(<salesforce_connection>, <salesforce_module><data_map>);

where,

ParameterDescriptionData type

<variable> 

is the variable which will contain the response returned by Salesforce.

KEY-VALUE

<salesforce_connection> 

specifies the name of the Salesforce connection.

TEXT

<salesforce_module>

specifies the module in Salesforce where the record will be added.

Following are the names of applicable modules.

Lead

Account

Contact

Case
SolutionProduct   Campaign
TEXT
<data_map>

Map with key as Salesforce field's name and the required value. For ex: {"Name":input.Name}

To learn about the mandatory fields, click here and navigate to the required module on that page. 

KEY-VALUE

Creating a record in Salesforce

The following snippet when executed creates a record in the "Account" module in Salesforce. 

accountinfo = { "Name" : input.First_Name, "BillingCity" : input.City, "Type" : input.Type, "Industry" : input.Industry};

response = salesforce.sales.create("Salesforce", "Account", accountinfo);

where,

ParameterDescription
accountinfois a map variable that holds the key value pairs
"Name"
"BillingCity"
"Type"
"Industry"
are names of Salesforce fields
input.First_Name
input.City
input.Type
input.Industry
are Zoho Creator field inputs
"Salesforce"is the name of the Salesforce Connection
"Account"is the module in Salesforce, where the record will be created
responseis response returned as map by Salesforce

Response Format

Following is a sample success response returned by Salesforce:

{  
   "id":"00190000010xPIuAAM",
   "errors":"[]",
   "success":true
}

To get the ID of the newly created record, execute the following script:

<variable> = <response_variable>.get("id");

The failure response returned, due to incorrect parameter value, is of the following format:

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

Related Links

Share this post : FacebookTwitter

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

Write to us: support@zohodeluge.com