Drupal Integration with Salesforce.com
Posted on: Tuesday, August 4th 2009 by Steve Shen

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

Comments

Another option for webform->salesforce is Saleseforce Webform module. Agaric did a little work around that with the visitorpath module.

We hope to see convergence among these modules, but after seeing our Drupal 5 version of salesforce module (similar in spirit to the modularization of the 6.x-2.x branch with webform integration) instead be joined by two more different approaches, we picked the lightest weight and most to-the-point solution for Drupal 6.

ben, agaric

Does this linking work with Sales Force Professional or do you need the Enterprise edition with API ?

http://www.salesforce.com/crm/editions-pricing.jsp

Ive just updated the Salesforce Webform Integration module (http://drupal.org/project/sf_webform) so that its compatible with the latest version of the Salesforce API (salesforce-6.x-2.x-dev). Updating your copy of the module should solve the problem.

Thank you for your update and for this useful module. It's working fine so far except for one thing: the message 'This webform is associated with fieldmap xx' on the 'node/xx/salesforce' page does not seem to always output the correct fieldmap index when multiple fieldmaps exist.

Working on the same issue (seem to be a lot of us!). Thanks for sharing your solution. This was also the first I'd seen about the Visitor Path module, which looks promising.

I'd like to second the question about Salesforce professional vs enterprise -- does any one know which is required for either the salesforce module or webform one?

thanks!

Thanks Steve for such a good help you have provided. I was also facing problem while exporting to salesforce when submitting webform. I have also tried using the help you provided but no luck, because does not have much knowledge of programming.

One more solution for the sf_webform module to work when webform submission is done, is apply this patch
http://drupal.org/node/892398

Hey there Can we map custom drupal form using the API If So can You give me some idea about that

Thanks,

Mohit

Post new comment

The content of this field is kept private and will not be shown publicly.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.