External Ids - how to use?

Hi. I have a postgres database table (customers) with 4 columns (id, name, phone, ts_created). Id is the primary key and a serial. The goal is to insert/update table rows as Salesforce accounts.

I am currently able to make accounts in Salesforce using the upsert method from Salesforce cloud connector but the service creates new/duplicate accounts everytime it is run.

How do I make upsert work as intended? Picture related.

External Id is a unique Id field on external system that can be used by Salesforce to check if an insert or update operation to be executed when upsert.

The external system can be my localhost database right? The id column is the one supposed to be referenced. I get that but I have no clue how or where to reference to it. What is intended to be in tns:externalIDFieldname? Putting just “id” there will not work.

For example, if you database table contains information like company info, there is a field called id, company name, address, and registration number.

You can use either id or registration number as the external id, as those two are unique numbers that able to decide whether a particular record existed in SFDC custom object or no.

In your case, i think you can use id. Then I think you also need id field on the left ens:Id. When the upsert call invoked to SFDC, it will check if this record existed in SFDC. If exists the upsert operation will execute update. Otherwise, it will execute insert to the table.

Ok. The thing was that I needed to create an external id field in the Salesforce object, account in my case, from the Salesforce setup.


I think it is an old link, but it helped me. The path in Salesforce Lightning Setup is: Platform Tools -> Objects and Fields -> Object Manager.

Then it was just to assign the field name (id__c) to tns:externalIDFieldName and database id to ens:id__c. String is the database id since I had to convert it to string from object as you can see from the service tree.