+ Start a Discussion
digitsungdigitsung 

update errors

I am attempting to update the 'Contact' table with the following codes.
 
custom fields:
 
MaxLoss__c (percentage)
 
update($id, $maxLoss)
{
$fieldsToUpdate = array('Id'=>$id, 'MaxLoss__c'=>$maxLoss);
 
try {
 sObject = new SObject();
        $sObject->fields = $fieldsToUpdate;
        $sObject->type = 'Contact';
        $contact = $mySforceConnection->update(array ($sObject));
 
digitsungdigitsung
I am attempting to update the 'Contact' table with the following codes.
 
custom fields:
 
MaxLoss__c (type: percentage precision 2.2)
 
update($id, $maxLoss)
{
$fieldsToUpdate = array('Id'=>$id, 'MaxLoss__c'=>$maxLoss);
 
try {
        $sObject = new SObject();
        $sObject->fields = $fieldsToUpdate;
        $sObject->type = 'Contact';
        $contact = $mySforceConnection->update(array ($sObject));
} catch( exception $e) {
        print( $e->faultstring );
        exit();
}
}
 
when the input $MaxLoss is "2", there is no error.
When the input $MaxLoss is "2.0", I receive the following error
 
Unexpected element {}BOGUS during simple type deserialization.
 
Please help
 
Ted
 
Tran ManTran Man
Strange, I couldn't reproduce it.

Can you print the following for me?

  print_r($mySforceConnection->getLastRequest());
  print_r($mySforceConnection->getLastResponse());

cwoodcwood
I've gotten this error when field values aren't explicitly cast to the correct types.

-c