web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Access Iframe body in MS CRM Form using java script

(0) ShareShare
ReportReport
Posted on by 990

Hello Experts,

We have HTML webresource as an IFrame on CRM Form, its simple HTML where we need to add html content to body dynamically. The code is working on CREATE form but same line of code won't work for UPDATE form. Below are codes.


HTML Web-resource :

<!DOCTYPE html>
<html><head><meta charset="UTF-8"></head>
<body style="font-family: Tahoma; font-size: 12px; margin-top: 0px; -ms-word-wrap: break-word;" bgcolor="#f6f8fa"><br></body></html>

JS Code :

document.getElementById('WebResource_HeaderText').contentDocument.body.innerHTML = headerText;

OR

var customHtml = Xrm.Page.ui.controls.get("WebResource_HeaderText");
var destination = customHtml.getObject().contentWindow.document;
destination.body.innerHTML = headerText;

headerText:

<b>Hello World! </b><font>- Please choose option : <br>
<ul>
<li>A</li>
<li>B</li>
<li>C</li>
<li>D</li>
<li>E</li>
<li>F</li>
</ul></font>

Please help, if anyone know about this.

Regards,
Rahul

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Preeti Sharma Profile Picture
    2,678 on at

    Hello Rahul,

    You can debug the code and check if there is any error while updating the form values.

    Thanks

    Preeti Sharma

  • Rahul-Waghmare Profile Picture
    990 on at

    Thanks for your reply Preeti,

    Yes I debug the code but it gets successfully executed without any error but at the form level it shows blank HTML.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans