Closed (fixed)
Project:
Salesforce Suite
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Jan 2010 at 09:51 UTC
Updated:
9 Jul 2011 at 23:14 UTC
I have installed this module and added login information. I am able to use the "Examine Data Structure" Test/Demo to list my salesforce standard and custom object definitions. However, when I use the other Test/Demo options like "Export your user account as a contact" I get a warning at top of the screen:
warning: Invalid argument supplied for foreach() in /home/sapkerb1/public_html/drupal/sites/all/modules/salesforce/salesforce_api/salesforce_api.module on line 575.
In the bottom half of the screen I see an error because salesforce is telling me that a required field is missing - [LastName]. This is understandable, but I am not sure why the warning is shown and hence I have opened this ticket.
Comments
Comment #1
aaronbaumanline 575 loops through the relevant fieldmap's fields array.
If php throws a warning, then perhaps you haven't defined any fields to be mapped to Salesforce.
Comment #2
TimAlsop commentedI have just installed the module, added login details and then tried to use the Test/Demo features. This is when I get this warning. I have not defined any fieldmaps - I have opened another ticket for that. Is this warning shown because I need to create a fieldmap for user object in drupal to map to contact in salesforce before I can use the Test/Demo ?
Comment #3
TimAlsop commentedI defined a fieldmap for user account to contact mapping - now the warning is not shown.
Maybe a better error can be shown when there is no fieldmap setup for the object, instead of a php warning which is not easy to understand ?
Comment #4
aaronbaumanTim,
Upon closer examination, I see that the demo export function arbitrarily chooses fieldmaps with id 1 (for a Contact) and id 10 (for a Campaign). It's a wonder the demo ever worked. Perhaps in the past these fieldmaps were created automatically, but this will almost always fail unless the user follows a very specific set of steps.
Even if we try to use a fieldmap created by the user, certainly we'll run into issues like failing validation.
Finally, it's not necessary to use a fieldmap to demonstrate that the salesforce api works.
here are some ideas of how to fix the test / demo:
Comment #5
TimAlsop commentedAaron,
I think it is ok for the fieldmap used by the test/demo to be created when the module is installed. The reason for this, is that the contact object in salesforce is a standard object, so the required fields can be configured and mapped in the fieldmap, and are unlikely to require changes. If for some reason the module user has special requirements, they can change the pre-installed fieldmap and then use the test/demo button. The test/demo button would need to check if the fieldmap for contact<->user is created and give friendly message if not, which would be the case if it has been manually removed after installation of the module.
Regarding the campaign - I am a bit confused as to why a salesforce campaing would ever need to be kept in sync with a drupal object - there are valid use cases for case, contact, account, lead etc. but campaign is used for marketing campaign tracking and a campaign record is only created when a marketing manager sets up a new lead generation campaign, then each lead/contact which relates to the campaign links to the campaign which was created by the marketing department.
Thanks,
Tim
Comment #6
aaronbaumanTim:
If a default fieldmap is provided for user->Contact, I think we can safely omit any demo dealing with "Campaign" object.
Comment #7
TimAlsop commentedYes, I agree. Also, perhaps the default objects should just be lead and contact instead of lead/contact/campaign.
Comment #8
aaronbaumanImplemented new hook_default_salesforce_field_maps and implementations for sf_node and sf_user (latest dev).
sf_user and sf_node now ship with default fieldmaps for User object and Page node, which can be overridden.
Both of these fieldmaps are now used in the demo section.
http://drupal.org/cvs?commit=372240
Comment #10
EvanDonovan commentedSorry to reopen this issue, but I am revisiting the demos for 7.x-2.x, and it looks like Tim still has a valid point - why is Node:Page->Campaign the default fieldmapping. Node->Case would be a much better example of a valid use case for this module. Would you be open to changing the default node fieldmapping accordingly?
Comment #11
kostajh commentedI don't have any objections to that.
Comment #12
EvanDonovan commentedOk, I'll probably do that in the next few weeks on 7.x at least.
Comment #13
EvanDonovan commentedReclosing in favor of #1214114: Change the Campaign fieldmap to a Case fieldmap.