Create a Record from Zoho to Salesforce
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. To connect Zoho Creator with Salesforce, add a new connection from the Setup - Connections page.
Supported Modules
- Account
- Case
- Campaign
- Contact
- Lead
- Product
- Solution
Syntax
<salesforceResponse> = salesforce.sales.create(
<salesforceConnectionName>,
<salesforceModuleName>,
<params>
);
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 newly created record. |
<salesforceConnectionName> | It referes to the connection name used to connect Zoho Creator with Salesforce |
<salesforceModuleName> | It refers to the module name in Salesforce where the record is created. |
<params> | It 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
To add a record to the accounts module, based on the values submitted from a Zoho Creator form, follow the below steps:
- Select the Form from your Dashboard page.
- Click on Settings - On Add - Actions on Success.
- Add the below script to the editor area.
- Click on Save Script to save the script definition.
//Declare Map Variable to hold the account details
Details = map();
//Add the account details to the map variable
Details.put("Name","Inteygrate");
Details.put("BillingCity","Hyderabad");
Details.put("Type","Prospect");
Details.put("Industry","Technology");
//creating the account in the Salesforce accounts module with connection name "Zoho"
salesforceResponse = salesforce.sales.create("Zoho", "Account", Details);
Response Format
The response returned by Salesforce will be in the format given below:
{"id":"00128000013bBMB","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"
}
Using Script Builder
To add the script using the drag-n-drop functionality in Script Builder,
- Select the Form from your Dashboard page
- Click on Settings - On Add - Actions on Success
- Click on Script Builder from the top-right corner of the page.
- Drag and drop the call function in the editor box.
- Select Integration tasks.
- Select Service as Salesforce.
- Select Function as Create Record.
- 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.
- Select the required Module name in Salesforce.
- Select the map variable that holds the key-value pairs for the create request (or) click on "New Map" to add key-value pairs for the create request.
- Specify the response variable that will hold the response returned by Salesforce.
- Click on Done to insert the call function task.
Upon submission of the form, the record gets added to selected module in Salesforce. The response variable will contain the response returned by Salesforce.