function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
stathostatho 

NuSOAP date format

Hello all,
 
 
I've posted a message as a RE to another thread but I haven't got any answers. I've moved to NuSOAP library, PEAR::SOAP is two heavy for what i intend to do with.
So I wanted to create a new event linked with a lead.

error : INVALID_TYPE_ON_FIELD_IN_RECORD


--------------------------code-----------------------------
$event = new SObject ('Event', null , array('ActivityDate' => '21/03/2006',
                                                'IsAllDayEvent' => true,
                                                'IsRecurrence' => false,
                                                'OwnerId' => $id,
                                                'Type' => 'Call',
                                                'WhoId' => $WhoId,
                                                'ShowAs' => 'Busy' ) ) ;

    $createEventRes = $sfdc->create($event);

---------------------------/code---------------------------

I tried : gmdate(), date() in a lot of different format.

Thanks
ClaiborneClaiborne

This worked the last time I posted it.

rchoi21 posted this message a couple of months ago . . .

$testDateEl = new soapval('TestDate__c', 'dateTime', '2005-12-19T19:51:12.174Z');

// create Contact
$contact = new sObject('Contact',
null,
array(
'FirstName' => 'Test',
'LastName' => 'Date',
$testDateEl,
)
);

$createResult = $sfdc->create($contact);

Maybe it will help.

David
stathostatho
This is not working. Nothing appens :(
chuckdubdubchuckdubdub

Unfortunately because some web hosting providers don't compile PHP with SOAP, I still use this library with certain clients. 

 

I just wanted to report that I tried this method and it did work!

 

 

    $xddate = gmdate('Y-m-d\T13:00:00\Z');

    $testDateEl = new soapval('VFS_Trial_Begins__c', 'dateTime',     $xddate );

    $contact = new sObject('Lead',
                           null,
                           array(
                               'FirstName' => $_POST['first_name'],
                               'LastName' => $_POST['last_name'],
                               'Title' => $_POST['title'],
                                $testDateEl,
                            $newsletterval
                           )                           
                          );
    $createResult = $sfdc->create($contact);
//    print_r("\ncreate one: \n\n");
print_r($createResult);
       // query Contact by ID
    $id = $createResult['id'];

$leadstatus = "\n\nThis is a new lead record.\n\n";

echo "Done insert!";