• ch9dev
  • NEWBIE
  • 0 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I am using php 5.12 and the newest PHP5 Toolkit 1.0.3

I am sending the following array of SObjects to a custom Table in sales force.
Code:
      Array
      (
            [0] => SObject Object
                (
                    [Id] =>
                    [type] => CUST_SALES__c
                    [fields] => Array
                        (
                            [SALES_CODE__C] => SALE
                            [INVOICE_NO__C] => 1233919
                            [INVOICE_DATE__C] => 2006-02-10T00:00:00-06:00
                            [QTY__C] => 19
                            [PRICE__C] => 19.00
                        )

                )

            [1] => SObject Object
                (
                    [Id] =>
                    [type] => CUST_SALES__c
                    [fields] => Array
                        (
                            [SALES_CODE__C] => SALE
                            [INVOICE_NO__C] => 1233929
                            [INVOICE_DATE__C] => 2006-02-11T00:00:00-06:00
                            [QTY__C] => 29
                            [PRICE__C] => gggg
                        )

                )

        ) 
The PRICE__C field in the second object is not a "xsd:double" and should throw an error, but I was hoping that it would insert the first record and return an error on the second record. Instead it just throws an exception and inserts nothing.

While this is not a huge deal with two records, I'd hate for a batch of 200 SObjects to fail to insert because one of them had an invalid type. Is this something I need to change in my table setup, or should I check all datatypes before calling create.  


 

Message Edited by ch9dev on 04-05-2006 10:12 AM

  • April 05, 2006
  • Like
  • 0
Hi There,
I finally downloaded the new PHP 5 toolkit, and am able to get everything to work, except creating a new lead.  From what I can tell in test, the line which it is getting caught up in, is the $result line. Please see code below.
 
    $mySforceConnection = new SforcePartnerClient();
    $sforceSoapClient = $mySforceConnection->createConnection($wsdl);
    $mySforceConnection->setSessionHeader($sessionId);
    $mySforceConnection->setEndpoint($location);
    $servertime = $mySforceConnection->getServerTimestamp();
    $myUserInfo = $mySforceConnection->getUserInfo();
 
 $fieldstoinsert =  array('FirstName'=>'mel','LastName'=>'hedge','Title'=>'me','Company'=>'bc','Email'=>'mel@bc.com','Phone'=>'222','State'=>'TX','Country'=>'USA','Industry'=>'Tech','Status'=>'Suspect','Region__c'=>'central','LeadSource'=>'web site','Contact_Source__c'=>'web site','OwnerId'=>'00G30000000lXXX');  
 $sObj = new sObject();
 $sObj->fields = $fieldstoinsert;
 $sObj->type = 'Lead';
 $result = $mySforceConnection->create(array ($sObj));