Welcome to MSDN Blogs Sign in | Join | Help

Microsoft Dynamics CRM IFRAME Magic

Microsoft Dynamics CRM allows you to access external web sites from within forms using IFRAMES (Inline Frames). You can configure the IFRAME to take information from the parent record. A pretty standard use of this is a Web tab on the Account form where the Account’s web site URL is passed to the IFRAME and the web site is available from a Web tab.

larry1

To do this, one sets up a little code for the form On Load event that puts the Accounts web site URL into the IFRAME’s URL. It’s actually pretty simple. Here is the code (assumes you already know how to set up an IFRAME). IFRAME_WebSite is the name of the IFRAME and .src references the URL it uses.

// Load web site URL
{
var AccountURL = crmForm.all.websiteurl.DataValue;
if (AccountURL != null)
{
crmForm.all.IFRAME_WebSite.src = AccountURL;
}
}

Having done this, I thought it would be neat to add a tab to display a map of the Account’s location. I used the same process except I stuffed address fields into the IFRAME URL instead of the web site. The code I used is:

// Load Map URL
{
var AccountStreet = crmForm.all.address1_line1.DataValue;
var AccountCity = crmForm.all.address1_city.DataValue;
var AccountState = crmForm.all.address1_stateorprovince.DataValue;
var AccountZip = crmForm.all.address1_postalcode.DataValue;

var MapURL = "http://maps.msn.com/home.aspx?strt1=" + AccountStreet + "&city1="+ AccountCity+"&stnm1=" + AccountState + "&zipc1=" + AccountZip + "&cnty1=0";

if (MapURL != null)
   {
      crmForm.all.IFRAME_Map.src = MapURL;
   }
}

The code is really pretty simple as you can see. But the results are pretty neat.

larry2

And the Live Search Maps give you different views such as Bird’s Eye which I love:

Larry3

There are lots of things you can do with IFRAMEs. Hopefully this will get your imagination going.

Cheers,

Larry Lentz

Published Wednesday, April 15, 2009 9:08 AM by crmblog

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# linkfeedr » Blog Archive » Microsoft Dynamics CRM IFRAME Magic - RSS Indexer (beta)

# re: Microsoft Dynamics CRM IFRAME Magic

I love this...took me only a few minutes to configure.  Yes, the imagination is running wild.

Thursday, April 16, 2009 1:07 AM by John Bourgeois

# re: Microsoft Dynamics CRM IFRAME Magic

I am trying to get that Live Maps with CRM working.

Can get it to work:

http://social.microsoft.com/Forums/en-US/crmdeployment/thread/115bbb78-f35c-463d-9a29-2113f02fee85

Somebody could help me out here?

Thursday, April 16, 2009 9:49 AM by Joey

# re: Microsoft Dynamics CRM IFRAME Magic

This is a great article, but this concept has already been created many times. It's available in the CRM As a Rapid Developer Platform book by David Yack and so on. It's a good article in a public place that will get lots of visibility instead of finding it within a book.

Thursday, April 16, 2009 1:14 PM by Jason C

# Creating a Map Tab in CRM

Using IFRAMES you can add lots of neat stuff to your CRM forms. I recently submitted an article to the

Thursday, April 16, 2009 11:55 PM by Larry's Taco Talk

# Creating a Map Tab in CRM

Using IFRAMES you can add lots of neat stuff to your CRM forms. I recently submitted an article to the

Friday, April 17, 2009 12:43 AM by Larry's Taco Talk

# re: Microsoft Dynamics CRM IFRAME Magic

Didn't see a note on this:

Be sure to uncheck the "Restrict cross-frame scripting" option on the IFrame "General" properties tab.... otherwise you can't access the fields on the other tabs.

Friday, April 24, 2009 10:08 AM by Matt Holt

# re: Microsoft Dynamics CRM IFRAME Magic

im confused by what to put in the URL line on the form.

i tried just about everything, even about:blank but it doesnt work.

Monday, April 27, 2009 4:05 PM by michael

# re: Microsoft Dynamics CRM IFRAME Magic

what is the  "&cnty1=0"; for Australia how can i get it

Monday, April 27, 2009 9:34 PM by Sahan

# re: Microsoft Dynamics CRM IFRAME Magic

Neat stuff, but I still have not been able to get a similar clear direction on how to show a contact's picture in an iframe.

Tuesday, June 16, 2009 7:32 PM by Ken

# re: Microsoft Dynamics CRM IFRAME Magic

Good one Larry. Simple & elegant!

Tuesday, June 23, 2009 12:48 PM by Steve Noe

# re: Microsoft Dynamics CRM IFRAME Magic

Hi All,

Excellent ... excellent article.

The Country appears to be hard-coded ( i.e. "&cnty1=0" ), what are the mappings for various countries?

cheers

ian

Monday, July 06, 2009 10:26 AM by ian

# re: Microsoft Dynamics CRM IFRAME Magic

Great stuff!  We used same technique to pass package tracking information stored in CRM right to UPS' package tracking site for a client of ours.  Just stuff tracking # from the CRM field into this url -   http://wwwapps.ups.com/WebTracking/track?HTMLVersion=5.0&loc=en_US&Requester=UPSHome&trackNums=12345&track.x=Track

Thursday, July 16, 2009 9:00 AM by Dan Moyers

# re: Microsoft Dynamics CRM IFRAME Magic

I have a hosted https CRM organisation.

Is it possible to have an iframe showing some http content (not https) even though I have my CRM hosted at a https location?

Tuesday, July 28, 2009 6:59 AM by henrik

# re: Microsoft Dynamics CRM IFRAME Magic

Thank you!!!!

I got it to work with Bing Maps, now I just need to figure out how to remove the "other" elements in the Bing map.

thanks again!

Tuesday, August 11, 2009 7:11 PM by Chris Espino

# re: Microsoft Dynamics CRM IFRAME Magic

Anyone had any issues with this crashing the print preview?   It crashes at the point where you select a printer.  

Tuesday, August 18, 2009 11:23 AM by Keith

# re: Microsoft Dynamics CRM IFRAME Magic

I cant get this to load.. to you put the // load map url in the URL line?

Do you put the rest of the code in on load event??

Thursday, August 20, 2009 10:22 AM by Michael Ross

# re: Microsoft Dynamics CRM IFRAME Magic

The //load map url (// = comment line) code builds the map url from the Account's address fields and then it is stuffed into the IFrame url.

Thursday, August 20, 2009 5:39 PM by Larry Lentz

# re: Microsoft Dynamics CRM IFRAME Magic

Is there any way to have the country not populate in the URL line?

Thursday, October 01, 2009 4:00 PM by Brad

# re: Microsoft Dynamics CRM IFRAME Magic

Hi,

Should this work in CRM 3.0?  I am having trouble in 3.0.  No matter what I do, the url I put in the IFrame comes up.

Any thoughts?

Thank you!

Voni

Thursday, November 05, 2009 1:30 PM by Voni

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker