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
Elie RodrigueElie Rodrigue 

PHP Enterprise Update fieldsToNull error

Hi, i'm having a weird error when trying to set some fields to null. Here my code :
$paramsToNull =  new stdclass();

$paramsToNull->Id = '---blanked---';
$paramsToNull->fieldsToNull = array('Month_2_Volume__c');
$conn = GetSalesForceConnection();
$response = $conn->update(array($paramsToNull),'Lead');

catch(Exception $e)
 echo $conn->getLastRequest();

And I get this error : SoapFault exception: [soapenv:Client] Unexpected element {}string during simple type deserialization

GetLast Request give me this :
<soap-env:envelope xmlns:soap-env="" xmlns:xsd="" xmlns:ns1="" xmlns:xsi=""><soap-env:header><ns1:sessionheader><ns1:sessionid>462400D70000000IU3D!ARAAQBoC7VBwLSMFVqdnzTQ8RvqOmelRsG5AZhI1.XaHCgIpkgrEO.X9iCOTkAcfQqmEUq5LjG6Va.4E27IrIaAi90_TvLkQ</ns1:sessionid></ns1:sessionheader></soap-env:header><soap-env:body><ns1:update><ns1:sobjects xsi:type="ns1:Lead"><id>00Q7000000L0yvAEAR</id><fieldstonull><xsd:string>Month_2_Volume__c</xsd:string></fieldstonull></ns1:sobjects></ns1:update></soap-env:body></soap-env:envelope>

If I remove the fieldsToNull value and add some other fields value, the update work fine.

 I tried to reproduce using .Net instead of PHP and it work fine, using the same wsdl file.

Please help,



Just a quick guess,

but make paramsToNull an SObject, i.e.


$paramsToNull =  new stdclass();


$paramsToNull =  new SObject();


Elie RodrigueElie Rodrigue
Hi, as I'm using the Enterprise part of the toolkit, the SObjet class is not available to me, and as I mentionned earlier, if remove the fieldsToNull properties, everything works fine... I've tried using an array instead of an stdclass and I got the same result...

Is there any acceptable solution besides the already suggested 'Switch to the Partner API'?



It seems kind of rediculous that baseline functionality is not working in a provided codebase for accessing the API.


Not to mention that the PHP Toolkit is a full 2 versions behind the active API.



I'm sure we're not the only people having these issues... how is it that the Enterprise API seems pretty neglected compared with the Partner?