Project:Salesforce Webform Data Integration
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Currently, the Salesforce Webform module and the Salesforce Suite are parallel, and in some situations, they seem actually not to work well together (I've run into errors when I've got them both going - I haven't delved deep to figure out why yet.) It seems to me that when moving this module to 7.x, it makes the most sense to have it use the Salesforce API and setup that the Salesforce Suite uses.

What are plans for 7.x?

Comments

#1

Title:Integration with Salesforce Suite?» Compatibility with Salesforce Suite
Category:feature request» bug report

Actually I believe the incompatibility with Salesforce Suite is a bug. If you look at salesforcefields.module, it include a function definition for salesforce_api_connect() as well as some other functions that implement the salesforce api. These functions were obviously copied from the Suite's salesforce_api.module. So, you get a php error/WSOD if you enable the real salesforce_api module and drupal tries to redeclare those functions.

In my case, I need salesforcewebform plus salesforce feeds. Salesforce Feeds requires salesforce_api for its own api calls, so at the moment there is no way to do this.

I think clearly one of two things needs to happen:

1. This module removes its own implementation of the Salesforce API and adds salesforce_api.module as a dependency.
2. The api functions in this module are renamed to follow drupal naming conventions (ie, salesforce_api_connect() becomes salesforcefields_salesforce_api_connect() or something).

Number 1 is, I think the preferable option, as it eliminates all the duplication we have here. Why have two implementations of the exact same api? Ideally, if there is a salesforce_api module, all other salesforce drupal modules should use that as a dependency. However, it also requires more work, I'd imagine - perhaps there are issues I'm unaware of that forced the module author to do it this way? If #1 isn't possible, #2 would at least allow us to use both modules.

I'm happy to pitch in with patches if I get some guidance from the maintainer.

#2

I have been looking into this for a project I am working on.
There is only one place the function is called, so renaming it is pretty simple:

salesforcefields.module

rename function salesforce_api_connect to salesforcefields_salesforce_api_connect

In the function that follows: salesforce_api_describeSObjects
rename the call to salesforce_api_connect to salesforcefields_salesforce_api_connect

To be on the safe side I would:
rename the salesforce_api_describeSObjects function to salesforcefields_salesforce_api_describeSObjects
then rename the call to it in salesforce_fields_salesforcewebform_fields

I haven't quite figured out how to create patches, and branches with the drupal system, so once I figure that out I'll try and post the changes I am working on.

One thing I have noticed, salesforcewebform only makes 2 calls to the salesforceapi, one to retrieve the field names for the objects, and the other to upsert the posted information to salesforce. It is a minor change to remove the salesforce_api from salesforcewebform, and then have it just use the salesforce_api_connect in the salesforce_api module.

However, installing salesforce_api installs the fieldmap logic, which the next step would be convert saleswebform to use the fieldmaps, which would make it almost the same as sf_webform project, with sf_webform being the preferred project because it is written to use more of the hooks from webform 3 and salesforce_api.

In my opinion, the setup required for creating a new webform using sf_webform compared to salesforcewebform is where the benefits are.

sf_webform new webform:
1. Create the webform
2. Add the fields
3. Go to Admin/ Salesforce
4. Create a field map for your webform
4.1 Pick your object
4.2 Map the pre-populated required fields
4.3 Add the optional fields you are using on the form, and map them to your webform fields
(you basically have to go back and forth from the webform edit screen to the admin fieldmap screen)

if you later wanted to add a new field to your webform:
1. Edit webform
2. Add the field
3. Go to Admin/Salesforce
4. Edit your field map
5. Add the SalesForce field, and map it to the new webform field

salesforcewebform:
1. Create the webform (selecting use salesforce, and pick your object)
2. Add the fields

if you later wanted to add a new field to your webform
1. Edit Webform
2. Add the fields

I believe this project is nice because of it's simplicity, for projects that are just using webforms to submit data to salesforce, the sf_webform is overkill.

That being said, the "embedded" salesforce api can be considered part of that simplicity. It's basically a standalone, straight forward solution to submitting records to salesforce.

I was thinking of changing my copy to support the salesforce_api if it's installed, but use the embedded one if the module is not installed.

One other thing I have found, is the sf_webform project doesn't seem to support submitting multiple record types, which makes sense since you have to know the order to submit them. So the Contact + Account option in salesforceweb, doesn't really translate to sf_webform.

Saleforce Suite (saleseforce api) uses fieldmaps to map SalesForce objects to Nodes. With the salesforce fields mapping to the node fields. sf_webform adds logic to link a fieldmap to the webform components and not the webform node fields. Since Salesforce suite is setup to map 1 salesforce object to 1 set of node fields, the same restriction passes down to sf_webform, where you can only link webform components to one saleforce object.

From my testing, the admin functions will allow you to define two fieldmaps (one for each salesforce object) for a single webform using sf_webform, however the submission to salesforce doesn't work, I believe it only submits whatever the last object it finds.

Another difference between the Salesforce Suite and this project is the submission of the salesforce data. This project uses the Enterprise client to retrieve the Salesforce Objects and Fields and then uses the Partner client to submit the data to salesforce. The Salesforce Suite uses only the Enterprise client.
From the Salesforce API Documentation the difference between the two, is the Enterprise is tightly typed while the Partner is loosely typed. I don't think this is a big issue, at least in my testing both work fine, I actually would prefer handling any data type issues before submitting to Salesforce rather than having Salesforce reject the submission and then dealing with it.

So after all talking your ear off, my humble opinion is that this project has two options, head towards obsolete and switch the development resources to making sf_webform a lot better, or keep the goal of this project to be a standalone, simple one-way WebForm to Salesforce module.

If you need both one-way and two-way transfer to Salesforce then use the SalesForce Suite.

#3

You know, I feel silly now, because I didn't realize sf_webform was basically what I was arguing for in #1. I will try to submit a patch for #2, as I still think that's something that should happen.

#4

Here is the patch, so far using the two in paralel right now, as I can't get sf_webform to work and don't have time to keep toying with it.

AttachmentSize
1017530-compatable-salesforce_suite.patch 1.44 KB

#5

Status:active» needs review

#6

Status:needs review» fixed

Added the patch in #4 to the 6.x-2.x branch this evening to prevent the name collision. Thank you to dafeder for creating the patch.

The 2.x branch of the module will continue to be a lightweight, one-way transfer to Salesforce module. Further compatibility with the Salesforce Suite will be in the 3.x branch. I have several clients who have no interest in installing the full Salesforce Suite for their use cases (sending form data to Salesforce only) and so will maintain the original intent of this module in the 2.x branch.

Bryan O'Shea

#7

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here