• anksphenomenon
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
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:

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 :(