Requirement
Enhance customer management by integrating the Contacts module of Salesforce with Zoho Creator.
Use Case
Consider an organization that manufactures electronic products and utilizes Zoho Creator Order Management Application for sales and relies on
Salesforce for CRM. They use Creator for order placement and product inventory management, and Salesforce to implement customer retargeting and analyze purchasing trends. When a customer wants to buy a product, the customer will approach the sales person and the sales person will place the order in the
New Order form of the Order Management Creator application. There are two types of customers: new customers and existing customers.
When a new customer approaches to place an order, the Salesforce integration form will be used to facilitate the collection of essential customer details. This data will be transferred automatically to the Salesforce Contacts module, after which the order will be placed.
For existing customers, the system will seamlessly cross-reference the entered customer's email with the records stored in the Salesforce Contacts module. Consequently, pertinent fields associated with the customer, such as name, phone number, address in the New order form, will be auto-populated by extracting the relevant data from the Salesforce to place the order.
Prerequisites
A
Salesforce account to store and retrieve customer details from its Contacts module.
Steps to Follow
Info:
Datasource and
connection are necessary for creating an integration form or integration field. If you already have them created, you can simply select the required datasource or connection. However, in the below steps, you will be creating a new datasource and connection while creating an integration form.
- Create an integration form to add the customer details to Salesforce, with the name Customer Details, and click Add Datasource.
- Click Add Connection in the pop-up to create a Salesforce connection.
- Provide the details shown below and click Create and Authorize.
You will be routed to the Add Datasource page. - Fill in the details as shown in the below image, then click Create.
Upon successful creation, the form builder of your new integrated Customer Details Salesforce form will open. - Drag and drop the following Salesforce's contact modules fields from the left pane of the form builder into your form. You can also add other fields from your Salesforce Contacts module depending on your preference.
This use case can be demonstrated using just the above-mentioned fields. You can include as many fields as required.
Form | Form Link Name | Field Link Name | Field Name |
Customer Details | Customer_Details | firstname | First Name |
lastname | Last Name |
email | Email |
phone | Phone |
mailingstreet | Mailing Street |
mailingcity | Mailing City |
mailingcountry | Mailing Country |
mailingpostalcode | Mailing Zip/Postal Code |
- Create a form with the following details to collect orders from the customer.
Form | Form Link Name | Field Type | Field Name | Field Link Name |
New Order | New_Order | Integration | Email | Email |
Decision Box | New Customer | New_Customer |
Name | Customer Name | Customer_Name |
Phone | Mobile | Mobile |
Address | Address | Address |
SubForm | Orders List | Orders_List |
Currency | Grand Total | Grand_Total |
Note: While creating an integration field in the New Orders form, select the details as shown below. You can also select the same datasource which is selected while creating the integration form. - Create a workflow to execute on user input of the New Customer field in the New Order form with the details shown below. This workflow will open the Customer Details integration form in pop-up, if the New Customer decision box is selected.
- Add the folowing code in the Deluge editor.
- //When the New Customer decision box is selected, the OpenUrl task opens the Customer Details integration form in a pop-up.
- if(New_Customer == true)
- {
- openUrl("#Form:Customer_Details","popup window","height=700,width=550");
- }
- Create another workflow to execute on user input of Email field in the New Order form with the details shown below. This workflow will fetch the customer details form the Salesforce and auto populate data in the respective fields.
- Add the followingcode in the Deluge editor.
// Create a list to add the required fields that needs to be fetched from the Salesforce contact module
- fieldList = List();
- fieldList.add("firstname");
- fieldList.add("lastname");
- fieldList.add("email");
- fieldList.add("phone");
- fieldList.add("mailingstreet");
- fieldList.add("mailingcity");
- fieldList.add("mailingstate");
- fieldList.add("mailingcountry");
- fieldList.add("mailingpostalcode");
- //Create a variable to store the response of the Salesforce - Get Records integration task which fetches the record from the Salesforce contacts module matching the email Id from the Email field.
- response = salesforce.sales.getRecords("Salesforce","contact","ID=" + "'" + input.Email + "'",fieldList);
- //If the Email field is not empty, populate the respective fields with the Salesforce - Get Records integration task response; otherwise, fill the respective fields with an empty string.
- if(Email.isEmpty() == false)
- {
- input.Name.first_name = response.getJSON("records").getJSON("FirstName");
- input.Name.last_name = response.getJSON("records").getJSON("LastName");
- input.Phone_Number = response.getJSON("records").getJSON("Phone");
- input.Address.address_line_1 = response.getJSON("records").getJSON("MailingStreet");
- input.Address.district_city = response.getJSON("records").getJSON("MailingCity");
- input.Address.state_province = response.getJSON("records").getJSON("MailingState");
- input.Address.country = response.getJSON("records").getJSON("MailingCountry");
- input.Address.postal_Code = response.getJSON("records").getJSON("MailingPostalCode");
- }
- else
- {
- input.Name.first_name = "";
- input.Name.last_name = "";
- input.Phone_Number = "";
- input.Address.address_line_1 = "";
- input.Address.district_city = "";
- input.Address.state_province = "";
- input.Address.country = "";
- input.Address.postal_Code = "";
- }
Steps to follow in your Salesforce account to allow OAuth access to the Zoho Creator application.