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
Cable Guy.ax375Cable Guy.ax375 

Set Date Field to Null

I have a java application and I try to set the date field in salesforce.com to null.

 

java.util.Date litDate = null;

updateBuilding.setLit_Date__c(litDate);

 

It doesn't work. How will I be able to achieve the goal? Any code samples?

 

Thanks in advance.

SuperfellSuperfell
use the fieldsToNull property instead.
Cable Guy.ax375Cable Guy.ax375
How can I utilize fieldsToNull property? Is this java code or a property configuration change?
SuperfellSuperfell
its a propery on the same object that has your date field. its an array, you set it to the field names you want to null out. It should be covered in the api docs.
MNiMNi

Hi Simon,

 

I am working on creating a button in SF that will updates a series of fields to Null. I understand from your posts that the right methoed is to use fieldsToNull. I just can't seem to find any Java code samples that shows how to use this. Can you help with that?  

 

I can get the following working in Java but I can't reset the Data field. I belive the right solution is to instead use fieldsToNull. What would I need to change?

 

Regards,

Morten

 

My code looks like this:

fieldsToNull = array("Installation_Date__c");

{!REQUIRESCRIPT("/soap/ajax/9.0/connection.js")}

var contact = new sforce.SObject("Contact");
contact.id = "{!Contact.Id}";
contact.PO_Number__c=" ";
contact.Installation_Date__c=" "

var result = sforce.connection.update([contact]);

if (result[0].getBoolean("success"))
{
    // Refresh window
    window.location.reload();
}
else
{
    alert("Error saving contact");
}