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

Why "fieldsToNull"?

In Salesforce, "fieldsToNull" used to explicitly set value to null. Such as I want to set BillingCity to empty, the I need send the request like:





My question is why Salesforce doesn't accept empty value directly? For example, the request data like:



<BillingStreet> Hive No. 9</BillingStreet>


Then the BillingCity is set to null. I think this is convennient for client to do the dynamical descision.





Best Answer chosen by Admin (Salesforce Developers) 

The problem is that many soap client tools don't give the programmer complete control over the serialization,even given the correct flags in the WSDL, for example in .NET it will alway serialize string fileds into an element, and so if the client dev does nothing it'll send <foo></foo> for each field they didn't explicity set. This means you can't do partial update which is an important feature for the update call. This is why there's an explict field to clear field values.