

Sudipta Deb
Founder of Technical Potpourri, Co-Founder of Shrey Tech, Enterprise Cloud Architect
Before Summer 24 Release i.e. before API version 61, when you use the HTTP Patch call to do some update on record, Salesforce performs the upsert operation i.e. if the record found with matching external id, api call is going to update the matching record, but if there is no matching record with the external id, then api call is going to create the new record with the details provided in the HTTP call request body. So it is basically an upsert operation.
But after Summer 24 release i.e. API version 61, Salesforce is introducing a parameter which you can pass in the API call to make sure it will only do the update to the existing record and if the existing record not found, it is not going to create a new record. The process will stop there.
So in this blog post and youtube video, I am going to explain this powerful enhancement. Please provide your feedback what do you think about this new powerful feature.
The form you have selected does not exist.
Watch The Video Or Read The Article (Or Do Both
)
Pre-requisite
I have created one custom field, named "External Id" in the account object. After that I have populated the field with some values in one of the existing Account record.
Also I have configured postman to connect with my Salesforce instance so that I can perform the HTTP call from there directly. I have published a video with the steps needed to connect Postman with Salesforce org. Sharing the video below just in case you need.
HTTP Call - Matching Existing Record
I have passed the external id value as 123456789 which I know is already there in the account named Burlington Textiles Corp of America. In the body of the HTTP call, I have provided is below and the HTTP call looks like -
{
"Name":"Burlington Textiles Corp of America",
"Active__c": "No",
"AccountNumber" : "ABCD1234"
}
As you can see in the above screenshot, I have added a parameter ?updateOnly=true. This is the new paramater that is being introduced in Summer 24 release i.e. API version 61. In the Path variable, I have provided SOBJECT_API_NAME as Account, EXTERNAL_ID as External_Id__c and RECORD_ID as 123456789.
Basically I am trying to update the existing record matching external id with the values provided in the body of the request. Now after executing this HTTP Patch call, below is the response, which indicates API call has successfully updated the existing record and not created any new record. If I now go to my account record, I will also notice the AccountNumber is changed to ABCD1234 for Burlington Textiles Corp of America

HTTP Call - Matching No Existing Record
I have passed the external id value as 1111 which I know is not there in any of the existing account. The body of the HTTP request is same. Call looks like -

As you can see in the above screenshot, I have added a parameter ?updateOnly=true. This is the new paramater that is being introduced in Summer 24 release i.e. API version 61. In the Path variable, I have provided SOBJECT_API_NAME as Account, EXTERNAL_ID as External_Id__c and RECORD_ID as 1111.
Basically I am trying to update the existing record matching external id with the values provided in the body of the request. Now after executing this HTTP Patch call, below is the response, which indicates API call has not found any matching record. So instead of creating a new record, the process stopped here.

Final Thoughts
To prevent creating a new record if the target record can’t be found or doesn’t exist, add the updateOnly parameter to a URL that executes an upsert operation. You can also use URLs with the updateOnly parameter in composite REST API and composite graph REST API.
Disclaimer
This article is not endorsed by Salesforce, Google, or any other company in any way. I shared my knowledge on this topic in this blog post. Please always refer to Official Documentation for the latest information.



0 Comments