Hi all,
I want to insert contacts in salesforce if contacts do not exist and update the contacts details if they do exist.
In my code I use $result = $client->upsert(array($sObject));
instead of $result = $client->create(array($sObject));
is it correct?
how does sf know if the contact exist (and then perform an update)? Is it because I should pass the unique identifier for the client along with other info? If yes, what is the field's name I should use?
$contacts = array();
$contacts['FirstName'] = $fname';
$contacts['LastName'] = $lname';
$contacts['Phone'] = $pnumber';
$contacts['Email'] = $'email';
Many thanks
In order to use the upsert method you have to have a external key set on a field within the object in Salesforce. You can use the ID field to upsert, but we use a external field that is a text field
and the correct line would be:
ORPHP Code:$results = $client->upsert("external_field__c", $sObjects);
PHP Code:$results = $client->upsert("external_field__c", array($sObject));
~Mike
testsdfsadfasdf
Bookmarks