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 :
Code:
$paramsToNull =  new stdclass();

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

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

And I get this error : SoapFault exception: [soapenv:Client] Unexpected element {http://www.w3.org/2001/XMLSchema}string during simple type deserialization

GetLast Request give me this :
Code:
<soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><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,
Elie

 

ClaiborneClaiborne

Just a quick guess,

but make paramsToNull an SObject, i.e.

change:

$paramsToNull =  new stdclass();

to

$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...
 
 
anthroproseanthroprose

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?