1

On AccountContactRelation we are using an external Id custom field Account_Contact_Id__c as the upsert field.

The first upsert for a particular ACR is succeeding in creating the ACR. However, further upserts (which we would hope would update the existing ACR) are failing with the following error:

[{"statusCode": "INVALID_FIELD_FOR_INSERT_UPDATE", "message": "Unable to create/update fields: AccountId. Please check the security settings of this field and verify that it is read/write for your profile or permission set.", "fields": ["AccountId"]}]

I've double-checked FLS on all fields.

I'm not sure what the issue is here, as we have not encountered this with any other SObject type.

0

Upsert won't work for your use case. You'll have to query then insert/update separately as appropriate. There are a few junction objects that behave like this in the system; you'll know them when you run in to one. The only practical use for upsert on this object is when you know you have an External Id that is already in Salesforce in order to update other standard/custom fields on the record.

| improve this answer | |
  • Well, that's upsetting (as opposed to being upserting). So, essentially if the SFDC record already exists, I need to do an update without including the Account/Contact lookup fields? (If so, could I do an upsert without those fields? Is there documentation on this?) – Ryan Chibana Mar 5 '19 at 1:24
0

I found the issue. I was using API Version 41 - upon upgrading to API Version 44, the upsert works. >_<

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.