integrate Salesforce with Drupal 8
Blog

How to integrate Salesforce with Drupal 8 website

Integration of CRM tool with web applications has turned out to be an undaunted task especially when you monitor/manage your contacts, existing clients and leads generated for marketing campaigns. In this post, I would like to walk you through Salesforce integration with Drupal web application. Let’s dive in to the basics of Salesforce.

Salesforce is a cloud-based CRM solution that helps business effectively manage sales, service, marketing, collaboration, analytics, and building custom mobile apps. In order to manage the business effectively, companies need to integrate their Drupal website with Salesforce CRM solution, which is quite configurable. Not to mention Drupal offers various modules that help in synchronizing your application with CRM. Check out how.

Prerequisites

Server requirement: 

SSL is mandatory for using Salesforce on the website.

Creating connected app in Salesforce

Step 1 Login your Salesforce account.

Step 2 Follow the steps:

           Setup->Apps->App manager->New connected App

Follow the steps as shown in the screenshot:

Setup navigation for New connected app

Step 3 Now you can see connected app form, select required fields.

3.1 Basic information: Provide basic information about your app. 

3.2 API (Enable OAuth setting): OAuth (Open Authorization) gives access to resources without revealing user credentials to apps and end user's account information can be used by third-party services. Select setting checkbox. 

Form sections for creating app


Step 4 Check whether the setting is selected or not as it toggles a form with some other required fields. 

Form section for creating app

Step 5 Enter the callback URL “yourdomain.com/salesforce/oauth_callback”.

Step 6 Select other fields as per your requirement and process it. Wait for 2-10 minutes before using your app. Now continue the process. 

New connected app

Here you will get the consumer key and secret key (these keys are required to connect Drupal to Salesforce). Now you can use the connected app on your Drupal website.

App’s final credentials

Salesforce module:

Download Salesforce module and install it on your Drupal website. Also, download and install dependent modules like key & encrypt.

Let’s check out the submodules in Salesforce and what they do: 

  • Salesforce: OAUTH2 authorization, wrapper around REST API.
  • Salesforce Mapping: Maps Drupal entities to Salesforce fields, including field level mapping.
  • Salesforce Push: Pushes Drupal entity updates in to Salesforce.
  • Salesforce Pull: Pulls Salesforce object updates into Drupal on cron run.
  • Salesforce Encrypt: This module is dependent on two other module Encrypt & Key so make sure these are installed. Module required for access and refresh token with security.

Setting up Salesforce on Drupal website: 

Step 1 Go to Configuration->Salesforce->Salesforce Authorization 

Step 2 Add the oAuth configuration setting here

Authorization setting form


Create Salesforce mapping: 

Before Salesforce mapping, make sure what exactly are you looking for. 

Scenario:

Let’s map out basic information, like first name, last name, email of Drupal users to Salesforce and push them to CRM tool. 

Follow this path (admin/structure/salesforce/mappings) to get a form similar to the shown below.

First step of Salesforce Mapping form

Now fill the list of values: 

  • Label: Label of the mapping.
  • Drupal Entity: Select users in both of the fields “Drupal Entity Type” and “User Bundle” in order to map out Drupal users. 
  • Salesforce object: Here the selected value should be contacted only.
  • Action Trigger: Ones you create a user on Drupal site, use that as a contact in Salesforce tool. For this, select all the data push actions, like insert, update, delete.

Now select Upsert key and Mapped fields.

Second step of Salesforce Mapping form


Upsert key: By setting Upsert key on Salesforce, you can prevent data duplicacy.

Mapped fields: Fill the following columns. 

  • Property: Listed Drupal fields
  • Salesforce field: Listed Salesforce fields
  • Direction: There are three directions on the radio button. Here you can see the mapped data that will be updated on Salesforce or on your Drupal site or will synchronize on both. Your mapped field data depends on this setting. 
  • Operations: If you don’t want to map this field then delete it by selecting the ‘delete field option’.

I have added Email as an Upsert key and for direction field, select “Drupal to Salesforce”.

How to test: 

Steps 1 Create a user from admin.

Note: Salesforce module will automatically push the data on CRM with contacts.  

Step 2 Run cron directly to update data with Salesforce contact by using the following path: 

/admin/config/system/cron 

The integration of Salesforce with your Drupal has endless benefits as it helps your sales and marketing to work efficiently and meet the process they perform on a regular basis in a more streamlined way. Further, it also enables you to custom-tailor industry-specific tasks, such as contact status in the Sales pipeline and contact reminders.

Below given is a presentation on "Salesforce integration with Drupal".

Download the Drupal Guide
Enter your email address to receive the guide.
get in touch