You need to sign in to do that
Don't have an account?
Elie Rodrigue
PHP Enterprise Update fieldsToNull error
Hi, i'm having a weird error when trying to set some fields to null. Here my code :
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 :
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
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
Just a quick guess,
but make paramsToNull an SObject, i.e.
change:
$paramsToNull = new stdclass();
to
$paramsToNull = new SObject();
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?