function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sailor67Sailor67 

Using REST API - how to update a record with a cleared record field?

I am using the REST API with XML and the HTTP PATCH method in order to update individual records e.g. Account. It works fine as long as the updated record have values in all its (xml) fields. But I cannot get it to work when I want to clear a specific field.

 

For example, lets say I want an Account record's Description field to become emtpy. I have tried variois ways below but nothing seems to work...

 

<root>
  <Description></Description> !-- also tried null, nillable etc -->
</root>

 

Thanks in advance 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Sailor67Sailor67

The only thing that seems to work is:

 

<root>
  <Description> </Description> !-- Note single white space -->
</root>

 

Not sure if this is the most proper way to set a field to NULL but it works(!) and hopefully it would help someone else.

 

I would appreciate if the Salesforce REST documentation would be upgraded..