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.
<iframe
id=”IFRAME_NEWCUSTOMENTITY” frameborder=”0″ runat=”server“
src=”http://localhost/Contoso/main.aspx?etn=new_mycustomentity&pagetype=entityrecord”>
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.
http://bingsoft.wordpress.com/2010/09/09/mscrm-2011-hide-areas-of-a-form/
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”;
// Move Form Content area up to top of window, initial style.top 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”).parentElement.style.display = “none”;
document.getElementById(“tdAreas”).parentElement.parentElement.parentElement.parentElement.colSpan = 2;
// Hide the Form Footer Bar
document.getElementById(“crmFormFooter”).parentElement.style.display = “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”;
This is how our custom page will now
On the save button click add the following Jscript code to save the record.
<input
id=”btnSave” type=”button” value=”Save” onclick=”return Save()”
/>
function Save() {
// call crmForm.Save
parent.document.forms[0].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”).parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.style.display = “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.
lookupItem.id = lookupItemOwner[0].id;
lookupItem.typename = lookupItemOwner[0].typename;
lookupItem.name = 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 …
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.
LikeLike
Hello
Can i declare a function in the onload, and then call this from the iframe. If so, how do i do it.
LikeLike
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.
LikeLike
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.
LikeLike
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.
LikeLike
I enjoy what you guys are up too. Such clever work and exposure!
Keep up the amazing works guys I’ve added you guys to my personal blogroll.
LikeLike
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
LikeLike
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.
LikeLike
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.
LikeLike
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.
LikeLike
This piece of writing is actually a pleasant one it assists new web viewers, who are wishing for
blogging.
LikeLike
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.
LikeLike
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
LikeLike
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?
LikeLike
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
LikeLike
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
vehicle.
LikeLike
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.
Cheers!
LikeLike
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.
LikeLike
Spot on with this write-up, I really believe this site needs much more attention.
I’ll probably be back again to read through more, thanks for the advice!
LikeLike
What’s up, the whole thing is going well here and ofcourse
every one is sharing facts, that’s really excellent, keep up writing.
LikeLike
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
LikeLike
Postherpetic neuralgia ofte occurs after an attack of shingles and can
be particularly painful. There are two majr reasons behind the bolne cancer pain.
Theey are a relativey common dog skin cancer in white dogs that enjoy sunbathing.
LikeLike
tramadol online tramadol 50 mg online – cheap tramadol eu
LikeLike
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.
LikeLike
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
LikeLike
What’s up it’s me, I am also visziting this site daily, this web site is
truly niche and the people are truly sharing good thoughts.
LikeLike