Accessing Xrm.Page or CrmForm through JavaScript from an html page showing CRM form in an IFrame

Suppose we have an html page having an iframe that shows a crm record. If we want to access the attributes on the form or call the save function from our html page, we can do it in the following manner.

var  crmForm =document.getElementById("myIframe").contentWindow.document.getElementById("contentIFrame").document.frames[0].document.forms['crmForm'];
var XrmPage =document.getElementById("myIframe").contentWindow.document.getElementById("contentIFrame").document.frames[0].Xrm.Page;

Hope it helps.


Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

Please share your thoughts

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.