Wednesday 4 January 2012

Configuring the Drupal Salesforce Suite Module

Assuming you have successfully installed the Salesforce Suite module on Drupal (as per my previous post Integrating Salesforce.com and Drupal) and you have a Salesforce account (Developer or Enterprise), then the next logical step is to connect the two together.

Luckily doing so is fairly simple, and largely done through the Drupal front end.

First, in your Drupal Admin suite, you need to navigate to the Salesforce settings page (admin/config/salesforce/). This is where you will provide an account username and password, as well as a generated API security token. Security tokens can be generated in Salesforce (and e-mailed to the registered address) through: Your name > Setup > My Personal Information > Reset My Security Token.

Next, you must (optionally) supply the module with your Salesforce WSDL definition. This contains (among other things) the object structure of your Salesforce implementation, and the connection end point URL. You can obtain your WSDL by clicking through Your Name > Setup > Develop > API and selecting the relevant link to download the Enterprise WSDL. If you don't do this, you will only have access to the standard Salesforce.com objects, and you may also experience trouble connecting to Developer or Sandbox accounts, by virtue of their different EndPoint URLs for login.

The module provides a couple of mechanisms for uploading your WSDL to Drupal, via the WSDL tab in the module configuration (admin/config/salesforce/wsdl). You can either directly upload the file, or point the module to the system folder containing the XML file. I did find, during development at this point, that if I needed to update my WSDL definition, I had to go through a fairly trial-and-error combination of clearing caches and reloading pages to get the new details properly installed.

Once the WSDL definition is set though, you are basically ready to go! All you need to do now is click through to the Object Setup tab (admin/config/salesforce/object) to choose the objects you wish to synchronise with Salesforce.com, and then define the mappings between the fields in Salesforce.com and the fields in your Drupal installation. I will cover the complexities of field mappings in a later post, but for now, you should at least have an operational connection between Salesforce.com and Drupal.

12 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. hi im following your tutorial and when i try to log in it gives me "Fatal error: Class 'SoapClient' not found in /var/www/html/sites/all/libraries/salesforce/toolkit/soapclient/SforceBaseClient.php on line 64" is there a solution for this? so far what i have is that i need to install soap php and im not really shure how to do that or if its necesary

    ReplyDelete
    Replies
    1. It does sound like you have a PHP config issue going on here. At the very least, I would check in your php.ini file, and make sure that the line

      extension=php_soap.dll

      is uncommented. You'll need to restart apache (at least) to pick up any ini changes.

      Delete
    2. thanks for the quick reply i think that migth be the problem i dont have access to files outside the drupal site is there a way to do it on phpmyadmin? like a sql command or probably a module for drupal to activate soap?

      Delete
    3. No, I'm afraid, for security reasons you can only alter php.ini directly on the file system. If you are using managed hosting, you can often request it to be enabled by an admin/customer services..?

      Delete
  3. Hello, This article is really helpful for me. Thanks so much.
    Anyway , i met a problem after click the save button for "Object Setup".
    The error is a list of this sentence: "Notice: Undefined index: Contact in salesforce_api_cache_build() (line 643 of /home/mywbiz/public_html/saleforce/sites/all/modules/0984477001351243156/salesforce/salesforce_api/salesforce_api.module).
    Notice: Trying to get property of non-object in salesforce_api_object_to_fieldmap_fields() (line 1869 of /home/mywbiz/public_html/saleforce/sites/all/modules/0984477001351243156/salesforce/salesforce_api/salesforce_api.module)."

    Can you help me to figure this out? Thanks so much for your help!

    ReplyDelete
    Replies
    1. Do you definitely have a connection to your Salesforce instance? You can use the "Test/Demo" tab to confirm this, the page will request the timestamp from your Salesforce organisation.

      Also make sure you are using the correct WSDL file for the connection, the instance and login URLs are included in this, so it must be the WSDL from your org, and associated with the authentication credentials you put in the settings page.

      Finally, I would say, clear your cache. During the SFDC development work I did here, I think I ran into a number of caching issues (which are very common in web-service work bridging so many gaps/layers!)

      good luck. let me know how you get on/if you get round this.

      Delete
  4. I thanks for this helpful post.

    I have generated my security tokens and pasted them into the authorization screen of the Salesforce Drupal module. I have the message 'Salesforce needs to authorized to connect to this website.' with a green tick next to it - which I assume means it is connecting fine.

    Unfortunately this is the only option I appear to have in the drupal salesforce module - I don't have any of the tabs shown in your screenshot.

    I'd really appreciate if you could you suggest what I might be doing wrong?

    I have tried reinstalling the module.

    Thanks, Paul

    ReplyDelete
    Replies
    1. Hi Paul, thank you for your comments.

      At a guess, I would imagine you are probably using a newer version of the Salesforce Suite module than that explained in this post... 7.x-3.0 is the latest build, and is a complete rewrite of the feature.

      If you have gone to configure the Salesforce API module, and you have entered your security token etc.etc. and got the message you described, that is the end of that part of the process, and you are connected.

      Next you now need to head over to STRUCTURE -> Salesforce and select Salesforce Mappings - it is now from here you can manage all your object mappings etc. using the fairly intuitive interface. There is no config page of tabs any more! :(

      Make sure you have the Mapping/Pull/Push sub-modules enabled too, incidentally.

      The new modules uses the REST API instead of SOAP, and is a vast improvement on many of the features. I haven't used it "commercially" myself, only to play around with, so I'd love to hear what you make of it too. The re-write was done by http://thinkshout.com/ and you can read up on it here: http://thinkshout.com/blog/2012/11/lev/salesforce-rest-oauth

      Delete
    2. Thanks - Ahh, so the settings are under 'structure' in the 7.x-3.0-beta4! I've got the 'Administration menu' module turned on, and salesforce isn't in the dropdown menu under 'structure'. However just click Structure and there it is! Cheers

      Delete
  5. Problem Solved - I was trying to 7.x-3.0-beta4 when i was hitting the problems above. I got rid of this and tried using the Drupal 7 version before (7.x-2.0-alpha3). This seems to work fine and I was able to connect with Salesforce and upload my wsdl file. I thought i'd put this up here in case anyone else runs into the same thing, or knows a better way of resolving my issue with the beta4 version.

    Right, on to try to make it do something meaningful!

    ReplyDelete
  6. Whoops - I didn't refresh the page, and therefore didn't realize that you had replied so soon Simon. Thanks for your suggestion. I've give beta4 another shot then and let you know how I get on. Cheers.

    ReplyDelete