A node fails to map over when Datetime field in Drupal when mapped to a DateTime field in Salesforce.

Fatal error: Uncaught SoapFault exception: [soapenv:Client] '2009-08-04 14:00:00' is not a valid value for the type xsd:dateTime in ... /sites/all/modules/salesforce/salesforce_api/toolkit/soapclient/SforceBaseClient.php on line 414

Comments

dougvann’s picture

I'm having the same problem.
Sales Force requires an ISO 8601 date format. which is a date(c) as reported on http://us2.php.net/manual/en/function.date.php
Drupal stores the unix timestamp and also stores a separate field for the format. If you're site uses date(Y-m-d H:i:s) then trying to pass that value to SalesForce will return an error.
Many people are using this modules. I don't think they are all hacking the module to pass the date(c) of the unixtimestamp value. Maybe they are. I'm prepared to hack the module to make it work BUT I'm curious why the problem has not been brought up before? How did anyone else avoid hacking the module?
Doug Vann
- Drupal Developer at www.DuoConsulting.com
- www.dougvann.com my blog
- www.twitter.com/dougvann twitter me

Bevan’s picture

Title: Datetime does not map to Salesforce Datetime » SoapFault exception for Datetime

Doug, this module is not yet stable this bug and has not been reported till now. Patches welcome.

Does this affect Drupal core's $node->date, CCK date fields or both?

aaronbauman’s picture

Status: Active » Postponed (maintainer needs more info)
EvanDonovan’s picture

@dougvann: Still facing this issue, or are you no longer using Salesforce module?

EvanDonovan’s picture

So is this for DateTime CCK fields only? The initial report would suggest yes...

EvanDonovan’s picture

Status: Postponed (maintainer needs more info) » Active

I think this should be caught by the following lines from salesforce_api_fieldmap_export_create():

 // The export handler should have handled this, but reformat to
// DATE_ATOM, just in case.
$object->$sf_fieldname  = gmdate(DATE_ATOM, $time);

If not can you add a dd() or dpm() after $time = strtotime($value) & $object->$sf_fieldname = gmdate(DATE_ATOM, $time); and report what you receive back?

Adding the following after // Get the value for the field from the handler function. in the same function might help debug also:
if(in_array($sf_field_definition['salesforce']['type'], array('time', 'date', 'datetime'))) { dd(array('Value of ' . $sf_fieldname . ' from handler function ' . $drupal_field_export_handler, $value)); }

That would let you know which SF fieldname was affected, so you could check on your mapping. State what kind of object as well.

If no response within 2 weeks, will be marked "Closed (cannot reproduce)".

aaronbauman’s picture

Status: Active » Closed (cannot reproduce)

I believe this issue has been resolved.
Please reopen if anyone can provide specifics on how to reproduce.