Hello everybody !
I'm trying to develop a very simple PHP interface interacting with Salesforce for creating a task. code and error messages are bellow..
As a matter of fact, It's not working : no task created.
Clearly a problem of dates, but I have tried so many things...
Could somebody please help me ?
TB.
<?php
require_once('salesforce.php');
$username = 'www';
$password = 'www';
$sfdc = new salesforce('partner.wsdl');
$loginResult = $sfdc->login($username, $password);
$batchSize = new soapval('batchSize', null, 2);
$sfdc->setHeader('QueryOptions', array($batchSize));
// variables du formulaire
$action = isset($_POST['action']) ? $_POST['action'] : '';
$login = isset($_POST['login']) ? $_POST['login'] : '';
$pass = isset($_POST['pass']) ? $_POST['pass'] : '';
echo '<form action="truc" method="post">';
echo '<input type="hidden" name="action" value="1">';
echo 'codebarre: <input type="text" name="codebarre"><br />';
echo '<input type="submit" value="valider">';
echo '</form>';
if ($action !=1 ) {
echo 'CHAIS PAS POUR TOI MAIS MOI G RIEN A FAIRE';
}
if ($action == 1) {
$response = $sfdc->getServerTimestamp();
print_r("\ngetServerTimestamp: \n\n";
print_r($response);
$startDate = $response;
$testDateEl = new soapval('TestDate__c', 'dateTime', '2006-12-19T19:51:12.174Z');
// Creer La Tache
$task = new sObject('Task',
null,
array(
'Status' => 'Completed',
'Subject' => 'Appeler',
'WhatId' => $idsur18car,
'Type' => 'A Rappeler',
'ActivityDate' => $testDateEl
)
);
$createResult = $sfdc->create($task);
print_r("\ncreate one: \n\n";
print_r($createResult);
}
?> |
It's not working : no task created. Clearly a problem of dates, but I have tried so many things...
Could somebody help me ?
I have the following result :
soapval Object ( [title] => NuSOAP [version] => 0.7.2 [revision] => $Revision: 1.4 $ [error_str] => [debug_str] => [charencoding] => 1 [debugLevel] => 9 [XMLSchemaVersion] =>
http://www.w3.org/2001/XMLSchema [soap_defencoding] => ISO-8859-1 [namespaces] => Array ( [SOAP-ENV] =>
http://schemas.xmlsoap.org/soap/envelope/ [xsd] =>
http://www.w3.org/2001/XMLSchema [xsi] =>
http://www.w3.org/2001/XMLSchema-instance [SOAP-ENC] =>
http://schemas.xmlsoap.org/soap/encoding/ ) [usedNamespaces] => Array ( ) [typemap] => Array ( [http://www.w3.org/2001/XMLSchema] => Array ( [string] => string [boolean] => boolean [float] => double [double] => double [decimal] => double [duration] => [dateTime] => string [time] => string [date] => string [gYearMonth] => [gYear] => [gMonthDay] => [gDay] => [gMonth] => [hexBinary] => string [base64Binary] => string [anyType] => string [anySimpleType] => string [normalizedString] => string [token] => string [language] => [NMTOKEN] => [NMTOKENS] => [Name] => [NCName] => [ID] => [IDREF] => [IDREFS] => [ENTITY] => [ENTITIES] => [integer] => integer [nonPositiveInteger] => integer [negativeInteger] => integer [long] => integer [int] => integer [short] => integer [byte] => integer [nonNegativeInteger] => integer [unsignedLong] => [unsignedInt] => [unsignedShort] => [unsignedByte] => [positiveInteger] => ) [http://www.w3.org/2000/10/XMLSchema] => Array ( [i4] => [int] => integer [boolean] => boolean [string] => string [double] => double [float] => double [dateTime] => string [timeInstant] => string [base64Binary] => string [base64] => string [ur-type] => array ) [http://www.w3.org/1999/XMLSchema] => Array ( [i4] => [int] => integer [boolean] => boolean [string] => string [double] => double [float] => double [dateTime] => string [timeInstant] => string [base64Binary] => string [base64] => string [ur-type] => array ) [http://soapinterop.org/xsd] => Array ( [SOAPStruct] => struct ) [http://schemas.xmlsoap.org/soap/encoding/] => Array ( [base64] => string [array] => array [Array] => array ) [http://xml.apache.org/xml-soap] => Array ( [0] => Map ) ) [xmlEntities] => Array ( [quot] => " [amp] => & [lt] => < [gt] => > [apos] => ' ) [name] => TestDate__c [type] => dateTime [value] => 2006-12-19T19:51:12.174Z [element_ns] => [type_ns] => [attributes] => ) create one: