You need to sign in to do that
Don't have an account?
mellyhedges
PEAR::SOAP issue updating ActivityDate for a Task
So, I am have a helluva time updating this pesky column; ActivityDate. I have read the discussions and have figured out that it's how the string is getting converted; however, I am having issues doing this with the old school PEAR::SOAP. I took someone's advice and changed the $Globals['SOAP_RAW_CONVERT'} = true. However, that worked for the date, but then would not properly convert my string values.
All I want to do is insert an ActivityDate for a new task. It seems liked I have tried everything, and have come very close, but it ultimately messes something else up.
Has anyone....(your grandmother, niece, dog, or postal carrier) been able to come up with a workable solution for this problem?
Thanks!
Melissa
$task = array(
'WhoId' => $contactid,
'Description' => utf8_encode("$comment"),
'Subject' => "Personal data updated",
'Status' => 'Completed',
'OwnerId' => $perpid,
'ActivityDate' => gmdate(DATE_ISO8601)
);
The array is then turned into a Task SoapVar and submitted to SF like this:
$taskvar = new SoapVar((object)$task, SOAP_ENC_OBJECT, 'Task', 'urn:sobject.enterprise.soap.sforce.com', 'Task', 'urn:sobject.enterprise.soap.sforce.com');
$res = $this->salesforce->create((object)array('sObjects' => $taskvar));
The DATE_ISO8601 constant is available in PHP >= 5.1.1, but you could look it up to check the exact format it uses if you're using an older version. I don't know how much of this is applicable to your problem, but at least you can look at this as something that works!
I'm actually in the middle of converting everything to use the SF PHP5 library (from my own PHP5 class), and I suspect the syntax there may be easier still.
The first step is to use SOAP_RAW_CONVERT dynamically: don't set it someplace in your code and leave it on. Just set it before you make a call that has a date value in it and then set it back to false after the call. Next, if you find that it's converting a string to something else you need to make sure the value doesn't look like something else. Adding a space to the end of the value should work. Similarly, to get a double, add '.0' to the end of a numeric value.
If you have a choice, look to moving to PHP 5. The soap library is much better and much faster.
Park
Thanks Park, that worked! :-)
I do agree with moving to PHP 5, and planning to do so in the next month or two...in the meantime, I had to get this piece working.
Thanks,
Melissa