You need to sign in to do that
Don't have an account?

No such column 'fields' on entity 'contact'. error while upserting a Contact
Hello guys,
I am trying to upsert a new account in to the sales force database. I have a custom wrapper function to do this in our system. Here is my code:
function sf_insertData($ArrData)
{
global $mySforceConnection, $mySoapClient, $mylogin, $ArrErrMsgs;
$sObject = new sObject();
$sObject->type = 'Contact';
// No Need to see this code
$ArrData['fields'] = array_combine(sf_mapSfFields(array_keys($ArrData['fields']),$ArrData['type']), array_values($ArrData['fields']));
$sObject->fields = $ArrData['fields'];
$result = $mySforceConnection->upsert('AccountId', array($sObject));
return $result;
}
With all the processing, I ultimately have this Object that goes into the upsert call:
When i run this code I get this error:
Fatal error: Uncaught SoapFault exception: [sf:INVALID_FIELD] INVALID_FIELD: No such column 'fields' on entity 'contact'. in /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/SforceBaseClient.php:396 Stack trace: #0 [internal function]: SoapClient->__call('upsert', Array) #1 /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/SforceBaseClient.php(396): SoapClient->upsert(Object(stdClass)) #2 /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/SforceEnterpriseClient.php(93): SforceBaseClient->_upsert(Object(stdClass)) #3 /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/sf_functions.php(169): SforceEnterpriseClient->upsert('AccountId', Array) #4 /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/sf_functions.php(41): sf_insertData(Array) #5 {main} thrown in /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/SforceBaseClient.php on line 396
what's wrong here?? I have kinda hit my head enuf on the walls :(
I am trying to upsert a new account in to the sales force database. I have a custom wrapper function to do this in our system. Here is my code:
function sf_insertData($ArrData)
{
global $mySforceConnection, $mySoapClient, $mylogin, $ArrErrMsgs;
$sObject = new sObject();
$sObject->type = 'Contact';
// No Need to see this code
$ArrData['fields'] = array_combine(sf_mapSfFields(array_keys($ArrData['fields']),$ArrData['type']), array_values($ArrData['fields']));
$sObject->fields = $ArrData['fields'];
$result = $mySforceConnection->upsert('AccountId', array($sObject));
return $result;
}
With all the processing, I ultimately have this Object that goes into the upsert call:
SObject Object
(
[type] => Contact
[fields] => Array
(
[FirstName] => Ankit Chbbad
[Phone] => 123456
[AccountId] => 0014000000Id67gAAB
)
)
When i run this code I get this error:
Fatal error: Uncaught SoapFault exception: [sf:INVALID_FIELD] INVALID_FIELD: No such column 'fields' on entity 'contact'. in /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/SforceBaseClient.php:396 Stack trace: #0 [internal function]: SoapClient->__call('upsert', Array) #1 /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/SforceBaseClient.php(396): SoapClient->upsert(Object(stdClass)) #2 /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/SforceEnterpriseClient.php(93): SforceBaseClient->_upsert(Object(stdClass)) #3 /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/sf_functions.php(169): SforceEnterpriseClient->upsert('AccountId', Array) #4 /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/sf_functions.php(41): sf_insertData(Array) #5 {main} thrown in /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/SforceBaseClient.php on line 396
what's wrong here?? I have kinda hit my head enuf on the walls :(
Also, if you are doing an 'upsert' then you will need to have the external id field in the object that you send. It doesn't look like that's the case here. Unless you have identified the external id field in the record definition you should be using 'insert' rather than 'upsert' to add a new record.
Park
Message Edited by Redsummit on 07-22-2008 11:32 AM
My connexion functions:
define("SOAP_CLIENT_BASEDIR", "phptoolkit-13_0/soapclient");
require_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');
require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php');
require_once ('phptoolkit-13_0/userAuth.php');
My upsert code on a custom object:
and the response:
Why does uspert tries to update the contact object instead of my custom one?