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
SrBlancoSrBlanco 

PHP: Error when trying to update object: "Fatal error: Class 'SObject' not found in..."

Hi All,

I am quite sure I am doing something stupid but i cant seem to get past this error.  I am using the Enterprise SOAP client of the new 1.1 toolkit for PHP and am trying to update this object:

Array (    
    [Id] => 50020000000hl5kAAA    
    [Maint_Account__c] => 00120000002jpViAAI    
    [Maint_On_Open__c] => false    
    [Maint_Current__c] => false
)


With this code:
    $casefieldsToUpdate   = array('Id'=>$case->Id,
                                  'Maint_Account__c'=>$case->AccountId,
                                  'Maint_On_Open__c'=>$caseassetcheck,
                                  'Maint_Current__c'=>$caseassetcheck
                                  );
    
    $sObject                = new SObject();
    $sObject->fields        = $casefieldsToUpdate;
    $sObject->type          = 'Case';
    $caseupdate          = $sfc_connection->update(array ($sObject));
When I execute my script I get this error:

    Fatal error: Class 'SObject' not found in [myscript].php on line 77

 Line 77 is the "$sObject = new SObject();" line.   


I have been pulling my hair out for half a day on this so if anyone can help I would really appreciate it.

Tran ManTran Man
SrBlanco, with the Enterprise WSDL, you don't need to instantiate an SObject object. Check out this sample:  http://wiki.apexdevnet.com/index.php?title=Members:PHP_Toolkit_1.1_Update_Sample_%28Enterprise%29&rcid=3969

Message Edited by Tran Man on 04-06-2007 12:08 PM

SrBlancoSrBlanco
Thanks Nick,

I am a bit of a noob when it comes to this stuff and I appreciate the help.

The link in your previous post doesnt seem to work for me.  [edit] nevermind, I found it...

Thanks, Michael

Message Edited by SrBlanco on 04-06-2007 11:31 AM

Tran ManTran Man
There seems to be a problem with the links in the message boards.
SrBlancoSrBlanco
Thanks again Nick.

I managed to get my updates working however for some reason custom fields will not update.  All of the examples have you populating the sObject like so:

    $sObject->customfield__c = 'field data';

That just wont work for me.  When I add getLastRequest() I can see the standard fields in the output but my custom fields are no where to be seen.  Any thoughts?

Thanks,

Michael