Bhoopathi

"Be Somebody Nobody Thought You could Be"

Friday, April 28

IFrames and Relative Paths

IFrames URL Setting in MS CRM for ISV Components:

I ran into this issue again and although I am sure I write about it before, I can’t find a reference to it.
The Scenario:

In Dynamics CRM 2011 it was quite common for companies (on-premise) to have custom ASP.NET pages 
that were shown within the context of the Dynamics CRM web site.  
Since they were always in a specific folder (the ISV folder), 
you could use a relative path to locate that page.
Here is an example of this practice:

image

The Problem

The problem appears after one of the updates to Dynamics CRM 2011 (I can’t remember which), 
but if you edit the URL field, CRM will automatically add http:// to the beginning of the URL.  
This will end up producing a totally invalid URL and your page will not load in the iFrame.

The Solution:

Unfortunately, once the change is made, there is no undoing it.  Here are your options:
1. Add a piece of JavaScript to set the URL.
2. Export, manually edit, and reimport the default solution.
3. Change the path to one that is fully-qualified.

#1 is the easiest to implement.
#2 is a painful, but one-time charge.
#3 will cause issues should you have a multi-server environment (development, test, production) 
and are constantly moving the solution around.

Conclusion:
So this is a fairly simple and innocuous change that many people will not look at twice .

– until they make a change and find that their iFrame no longer works, that is…