CRM Blog

Tuesday, March 18, 2008 - Posts

Adding An IFrame That Contains A View Of Related Entity
by Danny Varghese 03.18.08

Comments    12 Comment(s)
Situation

CRM has out of the box capabilities to add IFrames to entity forms.  These IFrames can allow a user to access any webpage inside of a system or custom CRM form.  The beauty of CRM comes to light here, with the fact that CRM forms are html web based pages, each with its own url.  Developers can take that url, and pass it into the IFRAME, to open up other entities, forms, or even associated views!  This comes in handy when clients don’t want to navigate away from the main screen to see information on related entities.

Example Of Use

For example, say on the Account form, you wanted to see an IFrame that contains an associated view of all activities belonging to that account.  Here are the steps you can take (again, this can be done with any entity):

1.       Under Settings à Customization à Go to entity form, open the form

2.       Add an IFrame to the tab and section you want, specify the name and set the url to “/_root/blank.aspx”

3.       Using JavaScript, add the code below to point the IFrame’s source to a given url.  In this case, the url of a window that has all activities related to a particular account.

var urlAct = ""; urlAct =  "areas.aspx?oId=" + crmFormSubmit.crmFormSubmitId.value + "&oType=" + crmFormSubmit.crmFormSubmitObjectType.value + "&security=" + crmFormSubmit.crmFormSubmitSecurity.value +"&tabSet=areaActivityHistory"; document.getElementById('IFRAME_History').src =urlAct;

4.       The code snippet above creates a url that points to an existing CRM view that has all activities for a given account.  Then it retrieves IFrame element by name (you specified this in step 3), and sets the source to the newly created url.

The result is on the Account form, wherever you placed the IFrame, it will show the view of all activities related to that account.  Again this IFrame can be created for any entity with a relationship to another entity.

Filed under: