The Microsoft Dynamics CRM Blog
News and views from the Microsoft Dynamics CRM Team

Microsoft Dynamics CRM IFRAME Magic

Microsoft Dynamics CRM IFRAME Magic

  • Comments 27

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

  • PingBack from http://www.linkfeedr.com/crm/188147/microsoft-dynamics-crm-iframe-magic.html

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

  • 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?

  • 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.

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

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

  • 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.

  • 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.

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

  • 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.

  • Good one Larry. Simple & elegant!

  • 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

  • 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

  • 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?

  • 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!

Page 1 of 2 (27 items) 12
Leave a Comment
  • Please add 7 and 2 and type the answer here:
  • Post