locked
Formonload is undefined when trying to view originating lead notes RRS feed

  • Question

  • Hi,


    I am trying to display the originating lead notes in the opportunity screen using the following coding however i get an form onload error?  We updated from crm 4.0 to crm 2013

    function leadNotes()
    (
    )
    function Form_onload()
    {
    var Primary = Xrm.Page.data.entity.attributes.get("originatingleadid");
        var IFrame = Xrm.Page.ui.controls.get("IFRAME_LeadNotes");
    
        if (Primary.getValue() != null) {
    
            var GUIDvalue = Primary.getValue()[0].id;
    
            IFrame.setSrc("/_controls/notes/notesdata.aspx?id="+ GUIDvalue + " &ParentEntity=3&EnableInlineEdit=false&EnableInsert=false");
           }
        else
    {
              IFrame.setSrc("about:blank");
            }
    
    
    }




    Tuesday, September 30, 2014 1:39 PM

Answers

  • Hi Clark,

    Set your IFRAME URL to About Blank.
    Use the code below:

    function Form_onload()
    {
    var Primary = Xrm.Page.getAttribute("originatingleadid");
        var IFrame = Xrm.Page.ui.controls.get("IFRAME_LeadNotes");
    
        if (Primary.getValue() != null) {
    
            var GUIDvalue = Primary.getValue()[0].id;
    
            IFrame.setSrc("/_controls/notes/notesdata.aspx?id="+ GUIDvalue + " &ParentEntity=3&EnableInlineEdit=false&EnableInsert=false");
           }
        else
    {
              IFrame.setSrc("about:blank");
            }
    
    
    }
    Saad
    • Marked as answer by ClarkKent786 Wednesday, October 1, 2014 10:13 AM
    Wednesday, October 1, 2014 5:50 AM

All replies

  • Can you post the error here?
    Tuesday, September 30, 2014 8:00 PM
  • Hi Clark,

    Set your IFRAME URL to About Blank.
    Use the code below:

    function Form_onload()
    {
    var Primary = Xrm.Page.getAttribute("originatingleadid");
        var IFrame = Xrm.Page.ui.controls.get("IFRAME_LeadNotes");
    
        if (Primary.getValue() != null) {
    
            var GUIDvalue = Primary.getValue()[0].id;
    
            IFrame.setSrc("/_controls/notes/notesdata.aspx?id="+ GUIDvalue + " &ParentEntity=3&EnableInlineEdit=false&EnableInsert=false");
           }
        else
    {
              IFrame.setSrc("about:blank");
            }
    
    
    }
    Saad
    • Marked as answer by ClarkKent786 Wednesday, October 1, 2014 10:13 AM
    Wednesday, October 1, 2014 5:50 AM
  • JK saad.
    Wednesday, October 1, 2014 10:13 AM