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
Catie KingCatie King 

Can't set fieldsToNull for Contact via Rest API update/patch call

I am using the REST API PATCH call to update a Contact like so:

URL: salesforce/data/<version>/sobjects/Contact/<externalidentifier>/<value>
JSON: map of fields to values

In addition to settings some values, I'd like to set others to null. I tried to pass fieldsToNull = [string, string, string] in the JSON.

However this results in a response saying:
"No such column 'fieldsToNull' on sobject of type Contact."

I also tried appending ?fieldsToNull=<field> to the request URL, which than returned successfully, but had no affect in respect to settings the field to null.

All documentation I can find providing examples with fieldsToNull are for soap/wsdl and not rest.
ShashankShashank (Salesforce Developers) 
Please try the example in this page: https://developer.salesforce.com/forums/ForumsMain?id=906F00000009ACaIAM
Catie KingCatie King
Quoted from that page:

"u can assign null values  as

Invoice.fieldsToNull = new string[] { "Invoice__c", "Finish_Date__c" };"

Being the rest API, I don't have a Contact object to set Contact.fieldstoNull on. I have a resource path to specify, and a json map for fields to specify.

Unless the Invoice object they reference in that example is in fact the json object. In which case it is the same thing I suggested I did, which is include fieldsToNull = [field, field, field] in the json.
Catie KingCatie King
A more concrete example on how I've attempted to use this:

URL (resource path to change):
/sobjects/Contact/login_id__c/<login id>
JSON (fields to set):
{
  "date_deleted__c": "2014-10-07",
  "fieldsToNull": [
    "provider__c",
    "identity_fullname__c"
  ]
}

Alternatively I've tried:

URL:
/sobjects/Contact/login_id__c/<login id>?fieldsToNull=provider__c
JSON:
{
  "date_deleted__c": "2014-10-07"
}
Erik NordlundErik Nordlund
Any news on this one?
Cory GrossCory Gross
Any luck getting an answer on this one?  I have the same question.
Aaron Bauman 15Aaron Bauman 15
Have you tried simply sending a null value for the field you want to null?
http://stackoverflow.com/questions/24549206/salesforce-com-rest-api-removing-object-fields-value
Albert MasonAlbert Mason
I have the same question. Any idea?