locked
OnLoad event JScript problem RRS feed

  • Question

  • Here is my JScript
    function MyFirstFunction() {
     var QuoteNumber = guidGenerator();
    
     var guid = Xrm.Page.getAttribute("new_quid");
     var quote_number = Xrm.Page.getAttribute("quotenumber");
    
     if (quote_number.getValue() == null)
    {
    guid.setValue(QuoteNumber);

    }
    } function guidGenerator() { var S4 = function () { return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); }; return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4()); }


    Basically what i'm trying to do is create a dummy guid on my quotes page.  It works great when it comes up empty, but when i try to pull up an existing record, it overwrites my dummy guid everytime.  This is on the onLoad event of the form.

    UPDATE:

    Never mind i figured it out.  Updated the code as well.

     

     



    • Edited by FutureSteel Tuesday, August 30, 2011 7:42 PM Solved
    Tuesday, August 30, 2011 7:15 PM

Answers

  • Jamie,

    The root of my problem was my logic.  I didn't really know how the entities relate to each other.  It was really an entity realtionship issue.

    Monday, February 13, 2012 3:52 PM

All replies