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

How to clear the value of a field through REST API?

I have a .NET service I'm building to give me access to the data in Salesforce. I'm trying to get my update method(s) to work. Specifically, I need to know how to clear the value of a field in Salesforce. I presumed that since we're using JSON to pass the data back and forth that I can just set the field to null in the JSON string and Salesforce will clear the current value. That appears to not be the case, or I'm just plain dumb. For example if I post {"Invoice__c":"blah blah blah"} it works fine. But if I post {"Invoice__c":null,"Finish_Date__c":null,"Scheduled_Date_Time__c":"\/Date(1333526400000)\/","Walk_Date_Time__c":null} nothing happens. I don't even get an error message back. It simply doesn't work.


Am I doing something wrong (I obviously must be doing something wrong)? How do I correct this?


Thanks in advance for any help!




u can assign null values  as 


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

Catie KingCatie King
I have this issue too, and can not find a solution anywhere.

Komathipriya, there is no Invoice object to set that on. Unless you mean Invoce to be the Json object. and that does not work (SF responds sayign there is no fieldsToNull object)
IT Systems2IT Systems2
I've found if I send a single white space that will blank out the field.
Aaron Bauman 15Aaron Bauman 15
But a single space is not the same thing as Null.
Eze Salesforce integrationEze Salesforce integration
We had to use dbnull.value not vbnull.