locked
Need to access the CRM form attirbutes from a html webresouce RRS feed

  • Question

  • Hi, I have a requirement, when I click on a button the crm ribbon, it opens a html webresouce, and needs access to crm form fields. I have written javascript inside html webresouce to retrive values,

    so when I use,

    var fieldvalue = window.parent.Xrm.Page.getAttribute("name").getValue().

    I get a runtime error saying, 'Page' is null or undefined. please help in resolving this.

    Friday, October 4, 2013 5:50 AM

All replies

  • Try using:

    document.parentWindow.parent.Xrm.Page.getAttribute("name").getValue();


    Regards, Karan Mittal
    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".

    Friday, October 4, 2013 6:15 AM
  • You will need something like:

    window.parent.opener.Xrm.Page.getAttribute("name").getValue()

    hth,

    Scott


    Scott Durow
    Blog www.develop1.net    Follow Me
    Rockstar365
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Monday, October 7, 2013 6:22 PM
    Answerer
  • Hi,

    Please try this:

    var nameValue;

    if (window.parent && window.parent.Xrm && window.parent.Xrm.Page && window.parent.Xrm.Page.getAttribute("name"))

    {

    nameValue = window.parent.Xrm.Page.getAttribute("name").getValue();

    }

    Or u can try the below:

    if (parent && parent.Xrm && parent.Xrm.Page && parent.Xrm.Page.getAttribute("name"))

    {

    nameValue = parent.Xrm.Page.getAttribute("name").getValue();

    }

    Regards,

    Rameshwari

    • Proposed as answer by RameshwariSah Tuesday, October 8, 2013 6:10 AM
    Tuesday, October 8, 2013 6:10 AM