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
alekshaleksh 

"Could not find deserializer for field" when updating custom ID field on object in PHP

I'm using PHP 5.1.2 with the php5-1.0.3 salesforce package and trying to update a field on a custom object that is a reference to a contact object:-

<?

require_once('soapclient/SforcePartnerClient.php');
require_once('soapclient/SforceHeaderOptions.php');

$sfcon = new SforcePartnerClient();

$soap = $sfcon->createConnection("partner.wsdl.xml");

$login = $sfcon->login("user@domain.com", "password");

$card_id = "x099000000099xxYYY";
$contact_id = "00990000009Yx9YYYY";

$fields = array
(
  "Id"=>$card_id,
  "Contact__c"=>$contact_id,
  "Status__c"=>"Active",
  "Pass_to_CA_System__c"=>true
);

$sobj = new SObject();

$sobj->fields = $fields;

$sobj->type = "CA_Card__c";

$card = $sfcon->update(array ($sobj));

?>

and I get the following error:-

Fatal error: Uncaught SoapFault exception: [soapenv:Server] org.xml.sax.SAXException: Could not find deserializer for field: Contact__c of type {urn:enterprise.soap.sforce.com}ID in /www/dev/salesforce/soapclient/SforceBaseClient.php:554 Stack trace: #0 [internal function]: SoapClient->__call('update', Array) #1 /www/dev/salesforce/soapclient/SforceBaseClient.php(554): SoapClient->update(Object(stdClass)) #2 /www/dev/salesforce/test005.php(29): SforceBaseClient->update(Array) #3 {main} thrown in /www/dev/salesforce/soapclient/SforceBaseClient.php on line 554

Contact__c is a reference to a contact record. (details from describe is at bottom of post)

If I comment out the "Contact__c"=>$contact_id, line, the record is updated...

what am I doing wrong?

Does the absence of a value for the "updateable" field indicate I don't have permission to update this field? and if yes, should this not return a different error?

info from describe:-

            [12] => stdClass Object
(
[autoNumber] =>
[byteLength] => 18
[calculated] =>
[createable] =>
[custom] => 1
[defaultedOnCreate] =>
[digits] => 0
[filterable] => 1
[label] => Contact
[length] => 18
[name] => Contact__c
[nameField] =>
[nillable] => 1
[picklistValues] =>
[precision] => 0
[referenceTo] => Contact
[restrictedPicklist] =>
[scale] => 0
[soapType] => tns:ID
[type] => reference
[updateable] =>
)

Tran ManTran Man
Very peculiar.  I couldn't reproduce the problem, but got the correct error message instead.

Code:
(
[errors] => stdClass Object
(
[fields] => Contact__c
[message] => Unable to create/update fields: Contact__c. Please chec
k the security settings of this field and verify that it is read/write for your
profile.
[statusCode] => INVALID_FIELD_FOR_INSERT_UPDATE
)

[id] =>
[success] =>
)
To answer your question about the "updateable" field, if there is no value set, then the field is read-only.
 

Message Edited by Tran Man on 05-01-2006 11:05 AM

alekshaleksh
Nick,

Thanks for your response.

I checked the account and it didn't have permissions. I am now using a different account and can now confirm that update = 1 on that partiular field.

I am however still getting the same error message.

I notice that the urn it is specifying in the error is "enterprise.soap.sforce.com" whereas the namespace I am using is "partner.soap.sforce.com".

The update works if I remove this one line and don't attempt to update the Contact__c field.

I have checked my partner wsdl and can find the type ID, however I am assuming that because it is expecting to find this in "enterprise" that it can't work out how to convert it to the type it needs.

I've checked all through the code and through the PHP salesforce client, and can find no reference to the enterprise urn, or indeed the word enterprise at all (with the exception of a breif mention in the instructions)

I have also downloaded and tried version 1.0.5 of the php toolkit, and it gives the same error

unikevinunikevin
I have the same problem ... using php toolkits
 
org.xml.sax.SAXException: Could not find deserializer for field: ContactId of type {urn:enterprise.soap.sforce.com}ID
when I  am attempting to create a case associated with contact...