locked
JavaScript - set value currency field to null RRS feed

Answers

  • Try this:

    Xrm.Page.getAttribute("new_yourfield").setValue(null);
    

    Jason Lattimer

    Friday, August 3, 2012 1:44 AM
    Moderator

All replies

  • Try this:

    Xrm.Page.getAttribute("new_yourfield").setValue(null);
    

    Jason Lattimer

    Friday, August 3, 2012 1:44 AM
    Moderator
  • I should note that I already declared the field as a variable like this:

        var myAttribute = Xrm.Page.getAttribute("fieldname");
        
       
    myAttribute.setValue(parseFloat(eval(null)));

    I understand your code being correct but it doesn't work for a currency field from what I can tell.  Any other options?

    Friday, August 3, 2012 1:47 AM
  • This does work on a currency field I have verified this. What result do you see when the code executes? Are you getting any JavaScript errors in the browser?

    var myAttribute = Xrm.Page.getAttribute("new_yourfield");
    myAttribute.setValue(null);
    

    Jason Lattimer

    Friday, August 3, 2012 3:09 AM
    Moderator