[SalesForce] Upserting Person Accounts using External IDs in Contact object

I am trying to upsert a record in Salesforce using the REST API.

My endpoint looks something like this

https://demoaccount--dev.my.salesforce.com/services/data/v45.0/sobjects/Account/Profile_UUID__pc/112233

The payload looks like this:

{
    "FirstName" : "John",
    "LastName" : "Doe",    
    "RecordTypeId" : "0120C0000006eySWER",
    "Profile_UUID__pc" : "112233",
    "Email" : "john.doe@mail.com"
}

As you can see I'm trying to upsert using the Profile_UUID__pc which is a field in my Contact object that can be accessed using __pc affix. Despite Contact.Profile_UUID__c being set as an External ID, and it being accessible to all profiles I cant upsert using it.

I get the following error:

[
    {
        "errorCode": "NOT_FOUND",
        "message": "Provided external ID field does not exist or is not accessible: Profile_UUID__pc"
    }
]

When I describe the Account object I can see that field is definitely available, but interestingly it shows "externalId": false in the field schema.

Can we not upsert using fields from the Contact object in Accounts?

Best Answer

You cannot upsert on the Account object using an External Key from the Contact object. I've had to move the fields into the Account object instead.

Related Topic