0
votes

I want to add a label to crm 2011 which displays the value of one attribute available on the form with a certain style. I plan to do it as below

  1. Add an iframe as a web resource.
  2. Now once the form load completes , edit the source property of the iframe and append the value as a query string parameter to it. 3.After that access that query string parameter in the html web resource and set it on the label.

Now my question is :

Can I use normal javacript (document.getElementById ...)inside the iframe to set the label.I understand that parsing the DOM in CRM 2011 forms is not supported.Is it also not supported inside the iframe ?

2

2 Answers

1
votes

You can reach the form just like you do in form customizations through parent.Xrm, so you could build a script like:

// example: grab the "name" field from the form
// this will only work from inside an IFRAME in the form, of course
function getName() {
    var attr = parent.Xrm.Page.getAttribute('name');
    if(attr !== null)
        return attr.getValue();
    else
        return null;
}
0
votes

Inside the WebResource you can use normal javascript, but it is up to you to make it compatible with all the browsers you want to support.