Kiran Ramesh
Kiran Ramesh

Reputation: 355

Salesforce Upsert using External Id gives an INVALID_FIELD Error

I have a custom object obj__c with external id extId__c in SFDC. Based on the article in https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_upsert.htm I do a /services/data/v40.0/sobjects/obj__c/extId__c/45754?_HttpMethod=PATCH call on Workbench. It updates the the record, if an obj__c with extId 45754 already exists. But if the obj__c doesn't exist then the following error is thrown (Basically Insertion).

message: The extId__c field should not be specified in the sobject data. errorCode: INVALID_FIELD

Upvotes: 0

Views: 2155

Answers (2)

Kiran Ramesh
Kiran Ramesh

Reputation: 355

I finally figured out the issue. I was passing extId__c field in the payload body also, which is forbidden.

Upvotes: 1

sfdc.sourabh
sfdc.sourabh

Reputation: 11

there are some changes post API version 37.0, which suggest using POST for insert instead of PATCH. You may try changing version to v36.0(or anything less than 37) , example: /services/data/v36.0/sobjects/obj__c/extId__c/45754?_HttpMethod=PATCH

Upvotes: 1

Related Questions