IFrames are a powerful extension tool within Microsoft Dynamics CRM 4.0. In addition to allowing you to host custom websites, IFrames allow you to present relevant data from external websites within the context of an open entity. As a quick example, this blog post will show how to present historical information regarding a company’s stock price from within an account form. I hope this example will inspire you to find many other ways to present relevant data to users through the use of IFrames.
Let’s jump straight into implementing this solution. When we’re done, we’ll have a new tab that has an IFrame reference to Google Finance search on the company’s ticker symbol, or if that isn’t provided, then the company’s name.
Step 1: Add a new tab to the account entity.
In the CRM web client, navigate to Customize Entities >> Account >> Forms and Views >> Form and click Add a Tab. Name the tab as you see fit – we’ll call it “Finance”.

Step 2: Add a Section to the new tab with the default options and then add an IFrame with the following pictured settings entered.


Step 3: Add JavaScript
While still on the form, navigate to Form Properties >> OnLoad. Merge the following code into any existing code in the OnLoad event. Be sure to check the “Event is Enabled” check box if it is not already checked.
var sUrl = "about:blank";
if (crmForm.all.tickersymbol.DataValue != null && crmForm.all.tickersymbol.DataValue != "")
{
sUrl= "http://www.google.com/finance?q=" + crmForm.all.tickersymbol.DataValue;
}
else if (crmForm.all.name.DataValue != null && crmForm.all.name.DataValue != "")
{
sUrl= "http://www.google.com/finance?q=" + crmForm.all.name.DataValue;
}
crmForm.all.IFRAME_finance.src = sUrl; |
It is a good idea to check for crmForm.FormType to ensure the code only fires when you expect it to, but this is optional. Another optional step would be to add this code to the OnChange event for the Ticker Symbol and Name fields. Also, you could hide the Finance tab whenever the Ticker Symbol field is empty, but note that hiding tabs is technically unsupported in CRM 4.0.
Step 4: Publish
Save and close the form and then click publish.

Conclusion
That’s it! Now users can get a quick view of the financials for a given company just by switching to the Financials tab. This piece of functionality demoed above is just a taste of what can be done with IFrames. In fact, this functionality is pretty redundant, since users can simple double click the Ticker Symbol on a form and get similar data from MSN Money. The only thing this piece of functionality that this specific customization provides is the ability to search on a company that doesn’t have the Ticker Symbol field filled out, since it uses the name instead. A couple of quick JavaScript changes, and you could easily modify this example to display driving directions from your main office to an account’s primary address using Bing or Google Maps. It is small improvements like these that can give an added boost your customer adoption campaign.