Skip to main content

How to connect Drupal 9 to Salesforce?

In this blog you will learn how to set up Drupal Salesforce Integration by synchronizing Drupal entities with Salesforce objects. It provides a step-by-step guide to help you create a Salesforce application and connect it with drupal 9. 


Create connected app in Salesforce

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

  • Provide basic information about your app

  • Enable OAuth settings and add the url callback
    The callback is: /salecesforce/oauth_callback

  • Select the OAuth scopes that you want to enable and place them in selected OAuth scopes

  • After saving the configuration a consumer key and a consumer secret will be generated


Drupal Salesforce module

Step 1:

Enable Salesforce submodules:

  • Salesforce

  • Salesforce Mapping

  • Salesforce Push

  • Salesforce Pull

  • Salesforce Encrypt

Step 2:

Configure the module:

  • Go to Configuration->Salesforce->Salesforce Authorization

  • Add the OAuth configuration setting

Create Salesforce mapping

In this case we will try to map drupal users and salesforce contacts.

Step 1: Config drupal

  • Go to admin/structure/salesforce/mappings and add mapping

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.

  • Select the fields that you want to map

Step 2: Start mapping data

  • Go to content > salesforce and you will find the mapped objects

  • In salesforce check the list of contacts

Test the mapping

  • Create a drupal user

  • Salesforce module will automatically push the user on CRM with contacts

  • Run the cron directly to update data with Salesforce contacts: