Working with CRM Forms in IFrame in CRM 2011

Suppose this is our custom entity named “new_mycustomentity” and we would like to show it in inside iframe within a custom aspx page.

Users can create the new record from within the custom page.

So we set the Iframe src to the url for creating new my custom entity record i.e.

id=”IFRAME_NEWCUSTOMENTITY” frameborder=”0″ runat=”server


However this is how it appears within in IFrame with no ribbons in it.

So the next step would be to hide the blank space on the top as well as left navigation bar.

Now we can use the following JavaScript that will hide the left navigation pane and blank ribbon. 

function HideArea() {

// Hide the Ribbon Toolbar and move the form Content area to the top of the window

window.parent.document.getElementById(“crmTopBar”).style.display = “none”;


window.parent.document.getElementById(“crmContentPanel”) = “0px”;

// Move Form Content area up to top of window, initial is 135px
// set it to the height of the iframe

window.parent.document.getElementById(‘contentIFrame’).style.height = “400px”;

 // Hide Left Hand Nav bar / pane
document.getElementById(“crmNavBar”) = “none”;
document.getElementById(“tdAreas”).parentElement.parentElement.parentElement.parentElement.colSpan = 2;
// Hide the Form Footer Bar
document.getElementById(“crmFormFooter”) = “none”;

Now the form looks like this within the IFrame

Next we will add an iframe in the entity’s form that will display a custom html page which has a Save Button in it to save the record.

However here we need to set the src of the IFrame dynamically through JavaScript in the form load otherwise our IFrame page won’t appear in the form.
So in form’s onload event add the following line

// set the IFrame src through JavaScript

crmForm.all.IFRAME_SAVE.src = http://server:port/CustomCRMPage/SavePage.htm&#8221;; 

This is how our custom page will now

 On the save button click add the following Jscript code to save the record.

id=”btnSave” type=”button” value=”Save” onclick=”return Save()”

function Save() {
// call crmForm.Save

Now let’s click on save and try to save the record,

 The record gets saved but here we can see two issues.

The top bar still shows “My Custom Entity – New” there.

And value for Owner field shows blank.

So here first we need to remove the Top Bar from the form using the following jScript in form’s onload

// hide the top bar

document.getElementById(“recordSetToolBar”) = “none”;

Now for the owner field ( lookup) we will have to do the following workaround.

Create a text field on the form, on save of form assign the Owner lookup’s name value to it. Hide this text field in the form onload.

Now in the onload event of the check if crmForm.ObjectId is null or not.

If not null than set the value of name for the owner’s lookup to this new hidden field’s value.

In form’s on save event à

function setOwner() {

var lookupItem = new Array;

lookupItem = crmForm.all.ownerid.DataValue;
// set the owner name in a separated text field
crmForm.all.new_hf.DataValue = lookupItem[0].name;

 And in the onload do the following à

if (crmForm.ObjectId != null) {

var lookupItemOwner = new Array;

lookupItemOwner = crmForm.all.ownerid.DataValue;
var lookupData = new Array();
//Create an Object add to the array.
var lookupItem = new Object();
//Set the id, typename, and name properties to the object. = lookupItemOwner[0].id;
lookupItem.typename = lookupItemOwner[0].typename; = crmForm.all.new_hf.DataValue;
// Add the object to the array.
lookupData[0] = lookupItem;
// Set the value of the lookup field to the value of the array.
crmForm.all.ownerid.DataValue = lookupData;


Hope this helps …


Author: Nishant Rana

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

28 thoughts on “Working with CRM Forms in IFrame in CRM 2011”

  1. I am new to all of this and trying to move my url to the left, it would be easier to just copy and paste the correct code. If you showed the entire code for the page then I could easily cut and paste only the parts that I need. I really appreciate you providing this info.


  2. Hello
    Can i declare a function in the onload, and then call this from the iframe. If so, how do i do it.


  3. Hi, I am Harish Kumar Gola working on CRM 2011, I tried to access CRM Account Entity in HTML Iframe of custom aspx page but it’s showing some javascript error, please let me know the solution if any…Thanks in advance.


  4. As a writer of goal achievement books, I have to love that kind of show.
    Its flexibility features makes you move around the house freely and easily.
    Or be prepared to pay a professional PR person to do it for you.


  5. The addition of an iOS application in your virtual marketing arsenal will help you in targeting your customers with a better approach and in a scalable manner.
    They provide a nice tactile feel and make it easy to find ‘home’ on the keyboard.

    If you are a glad consumer of Sprint, then you might most surely
    find their Sprint Loved ones Locator a fantastic instrument for keeping your
    partner’s mobile phone tracked.


  6. Wonderful blog! I found it while surfing
    around on Yahoo News. Do you have any tips on how to get
    listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Appreciate it


  7. I recently had a first hand look at Angler’s Club: Ultimate Bass Fishing 3D, the first fishing game to take full advantage of the 3D capabilities of the Nintendo 3DS. This is by far the most annoying thing I have ever experienced in the game (besides crashes). There are 3 levels of the Garden Badge: Bronze, Silver, and Gold being the highest.


  8. It was the comedy, however, which beat the destruction movie.
    Using pictures and other clips from the Minions, Minion Me 2 is an unofficial “Despicable Me” game , but still
    has some nice surprises. The Dukes was a victim of
    bad timing (its two biggest stars walking out just before production) and was a
    prime example of Hanna-Barbera’s animation factory at its worst.


  9. Another very big part of Zynga is their poker series;
    Poker Blitz, and Zynga Poker. Although Zynga has a good relationship with Facebook and generates 12% of
    that company’s revenue, Zynga is now looking to diversify its sources of income. That’s
    why it is really significant to often continue
    to keep up with new and helpful strategies, tricks and secrets.


  10. The usage of these two valves is that it is put on the hot air generators
    in four different ways. This handheld vaporizer is a heavy-duty portable vaporizer which catches everyone
    fancy. When you are looking at shopping for those who “medicate”, the medication itself is always a welcomed stocking stuffer.


  11. Good day! Would you mind if I share your blog with my twitter group?
    There’s a lot of folks that I think would really appreciate your content. Please let me know. Thank you


  12. Heya! I just wanted to ask if you ever have any trouble with hackers?
    My last blog (wordpress) was hacked and I ended up losing months of hard work
    due to no data backup. Do you have any methods to
    prevent hackers?


  13. I feel that is among the most significant info for me.
    And i’m glad studying your article. However wanna commentary on few normal issues, The web site style is wonderful, the articles is truly great : D. Excellent job, cheers


  14. Under federal law, marijuana use is still illegal even if some states have actually legalized
    medical marijuana. Reinhardt questions the assumptions made in formulating the Ohio estimates, and suggests the Lieutenant
    Governor may be providing Ohioans with misleading figures for political reasons.

    You will lose money for repairing the vehicle or even replacing it with another


  15. Hello there, I discovered your blog by way of Google even as searching for
    a comparable matter, your site came up, it seems great. I’ve bookmarked it in my google bookmarks.
    Hello there, simply become aware of your weblog thru Google, and located that it’s
    really informative. I am going to be careful for brussels.
    I will appreciate for those who continue this in future. Many other folks can be benefited from your writing.


  16. It is continually great to fill your day with enjoyment as this Sunday Night Football Live Stream starts
    the stages today. Your current laptop can stream live tv displays provided
    that it has speeds of better than 400 MHz together with
    a virtual memory of about 500mb. This workweek’s apps are football-themed games for respective months in the Super Bowl.


  17. Good day! This is kind of off topic but I need some guidance from
    an established blog. Is it tough to set up your own blog?

    I’m not very techincal but I can figure things out pretty quick.

    I’m thinking about setting up my own but I’m not sure
    where to begin. Do you have any points or suggestions? Appreciate it


  18. Since most people on the planet are regular users of a car,
    the fun of train travel is unfamiliar to most. Thus, if you
    have frequent business trips, consider investing in a travel
    suitcase. There are some other tips and tricks that can be helpful for you to conceive a baby boy, but these tips are probably some of
    the best and they can actually aid you to increase your odds to conceive a boy, especially if
    you’ll use them together with each other.


  19. Definitely believe that that you stated. Your favourite justification appeared
    to be on the web tthe easiest factor to underswtand of.
    I say to you, I definitely get annoyed whilst other folks think about concerns that they
    just don’t realize about. You managed to hit the nail upon thhe highest as smartly as outlined out the entire thing
    with no need side effect , folks could take a signal.
    Will likely be again to get more. Thanks


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 )

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.


Sharing my knowledge and experience about the Microsoft Power Platform.

Arpit Power Guide

a guide to powering up community

Welcome to the Blog & Website of Paul Andrew

Technical Leadership Centred Around the Microsoft Data Platform

Deriving Dynamics 365

Deriving Solutions and features on Power Platform/Dynamics 365

The CRM Ninja

Thoughts & musings from a Dynamics 365 Ninja!

D CRM Explorer

Learn about Microsoft Dynamics CRM Power Platform customization and implementation and other cool stuffs

Stroke // Jonas Rapp

I know pre-stroke. I will improve who I was.

Power Melange

Power Melange By Shalinee

Clavin's Blog

Power Automate - Power Apps - SharePoint Online - Azure - Nintex - K2 - Artificial Intelligence

Sat Sangha Salon

An Inquiry in Being

The Indoencers

The Influencers & Influences of Indian Music

Monika Halan's blog

Hand's-free money management

D365 Demystified

A closer look at Microsoft Dynamics 365.

Microsoft Mate (msftmate) - Andrew Rogers

Experienced consultant primarily focused on Microsoft Dynamics 365 and the Power Platform


Specific topics by Django Lohn on the whole Microsoft365 Stack

Manmit Rahevar's Blog

One Stop Destination for Microsoft Technology Solutions


Naturally Curious

Brian Illand

Power Platform and Dynamics 365

Steve Mordue MVP

A Microsoft Business Applications MVP

Subwoofer 101

Bass defines your home theater

SQLTwins by Nakul Vachhrajani

SQL Server tips and experiences dedicated to my twin daughters.

Everything D365

Discovering Azure DevOps and D365 Business Applications

Tech Wizard

Lets do IT Spells

XRM Tricks (Power Platform & Dynamics CRM )

Power Platform & Dynamics CRM


Mail to for queries and suggestions

Giving back to the community what I have learned

xrm CRM Dynamics

Dynamics CRM Technical & Functional Info

Dynamics 365 Blogs - Explained in unique way

Sometimes you need to look at things from different perspective.

CRM Keeper

Dynamics 365 Customer Engagement, CRM, Microsoft CRM, Dynamics CRM


Step into the world of a Dynamics 365 Consultant

Dianamics PCF Lady

Diana & Dynamics 365 & Power Platform

Sara Lagerquist

No Code Customization Concepts

%d bloggers like this: