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

  • Rahul-Waghmare Profile Picture
    990 on at
    RE: Access Iframe body in MS CRM Form using java script

    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.

  • Suggested answer
    Preeti Sharma Profile Picture
    2,678 on at
    RE: Access Iframe body in MS CRM Form using java script

    Hello Rahul,

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

    Thanks

    Preeti Sharma

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans