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
sf_davesf_dave 

How does upsert know the record type?

I'm wrapping the PHP  API and I would like to upsert for both create and update calls from our external application, however I'm a little baffled how salesforce knows what you are trying to upsert based on an external id.

Can't I create a custom field in Account's named "MyID" and a second custom field in Contacts called "MyID"?

And at this point how would salesforce know what i'm talking about when i say
$salesforce->upsert("MyID__c", $objects);

Thanks
-Dave
sf_davesf_dave
Ok,

I updated my Contact and Account to both have a field named "ExternalId" which was setup as an external id.  I then exported my wsdl and tried to upsert an object with a phone number (since it is a common field to both Account and Contact) and a new ExternalId__c.

The upsert failed because LastName is a missing required field, so it is obviously defaulting to a Contact v.s. an Account.  Is there any logic behind this?  I suppose we are supposed to keep our External ID's named differently across "Objects"

Any insight on this is appreciated.
-Dave