Microsoft Dynamics 365 Blog

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.


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 = "" + 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.


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


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


Larry Lentz

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!