This looks great! But I need to extend it to a custom object of mine. How would I begin to do this?

Comments

itdcole’s picture

Assigned: itdcole » Unassigned
itdcole’s picture

Status: Active » Fixed

*Needs better documentation*

The path for the soapclient needs to be the full path.
ex. "/var/www/html/{website folder}/modules/salesforcewebform/includes"
Not. "/{website folder}/modules/salesforcewebform/includes

To change it to a custom object find the code that says (around Line 277 in salesforcewebform.module):

  $sObject = new sObject();
  $sObject->type = 'Lead'; // Salesforce Table or object that you will perform the upsert on
  $sObject->fields = $all_fields;
  array_push($sObjects, $sObject);

And change "Lead" to the qualified API Name.
ex. "custom_object_name__c"

Status: Fixed » Closed (fixed)

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

amariotti’s picture

Status: Closed (fixed) » Active

How hard would it be to add this as a field in the webform to determine which object type the push went to? You mentioned in your "ex." that you could add "custom_object_name__c" to replace 'Lead' in the code. Would that fix this? It would be awesome if this feature could be added so that each webform could potentially push to different object types (i.e. Contacts, etc.).

obsidiandesign’s picture

Assigned: Unassigned » obsidiandesign
Category: support » feature
Status: Active » Needs work
StatusFileSize
new7.87 KB

First test at including the ability to link to Accounts, Contacts, or Leads through the same form. Please make sure to run update.php if you try the patch, as the object type is stored into the database. THIS IS NOT PRODUCTION READY, so only use on test/demo systems. I would like some eyes on the patch & interface to see if it will meet peoples needs.

There are also some minor documentation & code style changes I noticed & an attempt to catch error messages & set them through drupal_set_message. The bulk of the patch, however, is the changes for custom objects.

Bryan O'Shea
Obsidian Design

amariotti’s picture

Just to keep from killing our live site I tested this on another Drupal install on the same server and I am getting the following error:

warning: Missing argument 3 for salesforcewebform_process(), called in /www/sites/all/modules/webform/webform.module(1759) : eval()'d code on line 3 and defined in /www/sites/all/modules/salesforcewebform/salesforcewebform.module on line 222.

(This one is duplicated about 20 times) warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /www/sites/all/modules/salesforcewebform/salesforcewebform.module on line 260.

Required fields are missing: [LastName]

Thank you, your submission has been received.

One thing that we're a little nervous about is that we have a Private Data model on our SF instance. We also have Person Accounts enabled... if none of that makes sense then maybe we need to talk. I'm hoping that those things don't cause any problems, but it's possible. What we may need to do is re-activate your account on our SF Instance so you can do your tests there. Not sure what else to do here. We really need to get this done asap. Get in touch with me if this is going to be more time that we can compensate you for.

Thanks,
Andrew

amariotti’s picture

Here's some API documentation about Person Accounts: http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_guide...

Also might be helpful for Person Account stuff: http://community.salesforce.com/sforce/board/message?board.id=apex&messa...

amariotti’s picture

I have re activated your account on our instance. Let me know if you have any problems getting in. Contact me directly.

obsidiandesign’s picture

StatusFileSize
new8.5 KB

Version 2 of the patch for testing; accounts, contacts, and leads work. Better handling of errors using drupal_set_message for better debugging.

obsidiandesign’s picture

Also, for anyone else testing - please note the important change in INSTALL.txt - when adding the code to the additional processing box, there are now three arguments to the function.

amariotti’s picture

Just an update. The above patch adds the ability to push to Accounts, Contacts and Leads using this module. We've tested the above patch and things seem to be working properly now with the ability to debug. Last step is to organize the fields in the field mapping dropdown to make it easier to map your fields and know what's required when you're using different object types. Update coming soon!

obsidiandesign’s picture

Status: Needs work » Needs review
StatusFileSize
new17.62 KB

After a series of patch changes and tests, I'm happy to be able to share a version 9 of the patch referenced in #9. It handles Accounts, Leads, Contacts, and Account+Contact combinations. Some documentation needs to be updated, but the functionality is there. Anyone that can test and review would be a huge help in pushing this forward.

obsidiandesign’s picture

Status: Needs review » Fixed

Committed to 6.x-dev.

Status: Fixed » Closed (fixed)

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