+ Start a Discussion

Set number field to 0 or empty

I have an existing record with a number field that I can use AJAX/JavaScript to update the field to any number but zero.  Is there are trick to setting a number field to either "0" or null/empty.
I am using AJAX 8.0 / Javascript and using the new sforce.SObject() method.
I have tried fieldname = 0; fieldname = "null"; field name = "nothing"; fieldname = "empty"; and seeting a variable to 0 then fieldname = variable;
As soon as I set the fieldname = 1 it successfully updates.
Thanks in advance...

fieldname = null;



Thanks for the feedback - your suggestion works.  By looking into this with your suggestion, I found that my hang up was actually the fact that I was using another variable in some math, and inadvertantly setting a field to the NaN value given by bad math (like 100/0).  I learned that if one of my numeric fields to be updated is set to this "NaN" I get the error.