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

Announcements

No record found.

News and Announcements icon
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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans