Drupal Integration with Salesforce.com

August 4
blog author

Appno Blogger

Appnovation Coop

Currently, we are working on a Drupal 6 project that requires integration with Salesforce.com. We use the Salesforce module for Drupal 6 (http://drupal.org/project/salesforce). We also use the webform module to create the desired form. The data will be sent to Salesforce.com after a user fills out and submits the form. To achieve this, we need to map the webform fields to Salesforce lead fields. We searched and found the Salesforce Webform Integration module (http://drupal.org/project/sf_webform). We realized later that this module didn't really work with the salesforce-6.x-2.x-dev module.

The Salesforce Webform Integration module is using $map['index'] and $map['webform_nid'] to refer to fieldmap index ('fieldmap' field in table 'salesforce_field_map') and webform node id ('nid' field in table 'salesforce_webform'). However, you can't find $map['index'] and $map['webform_nid'] in the 'map' variable in salesforce-6.x-2.x-dev. Instead, salesforce-6.x-2.x-dev is using $map['fieldmap'] to refer to the fieldmap index, and it does not have the webform node id info in the 'map' variable. A quick and temporary fix to this issue, if you want to make use of the existing good work without spending much time writing your own module, would be simply to replace all $map['index'] with $map['fieldmap'] in the file sf_webform.module and assign a value to $map['webform_nid'] via a custom function that retrieves webform node id based on fieldmap index.

You can also implement your own hook_fieldmap_objects() to pull the desired fields for field mapping (see examples in Salesforce Node or Salesforce User module that are part of the Salesforce module). We hope this useful module will be updated soon and made compatible with salesforce-6.x-2.x-dev. By the way, for those who are new to Salesforce, you need to sign up for a Salesforce developer account (http://developer.force.com/) to perform testing and other related jobs.

The settings of Salesforce module require username, password and security token from your Salesforce account. To get your Salesforce security token simply:

  1. Log into your Salesforce account
  2. Go to Setup
  3. Go to Personal Setup
  4. Look under My Personal Information
  5. Select Reset My Security Token