I have embedded an HTML web resource that contains some input boxes in a custom CRM form. In the CRM form I have created some fields that corresponds to the input boxes in the web resource and they are hidden.
The reason to do so was the limitation of the CRM not giving me the flexibility of the layout I was looking for. So basically, the user enters the data in the web resource and once saved they write to the hidden fields. On the other hand, when the form loads
the values from the hidden fields are copied into the web resource input boxes.
I am having a hard time setting those input boxes from the corresponding hidden fields on the form. I can read the crm fields easily using JavaScript. I can also get to the HTML web resource using the following:
var target = Xrm.Page.getControl("WebResource_CriticalPath").getObject(); I also appended the contentWindow.document to the end of this and it comes back not null but when I try to get to the HTML element which is the inputbox I am trying to set
the value to, I get a null reference. I am using:
target.getElementById('input20'); to get to the element. I know this is not supported and I have to use Xrm.Page but I cannot figure out how to do so.
Also, any advice on how to do the writing back (i.e. from the element to the form field) when the record is save would be helpful.
I really appreciate any comments/help in this regard.