Dynamics CRM 4.0: Placing an Associated View in an iFrame

By in Customization, Dynamics CRM on Thursday, October 29th, 2009

I know we all have done this before, but it seems like someone struggles with it every time. Here is a function that you can use in the OnLoad event that makes this a little easier. The only thing you need to change is the name of your iFrame and the area name that goes into the function call, i.e. GetFrameSource(“areaExistingProducts”) where “areaExistingProducts” is the associated view that you want to show in the iFrame. The area can be found by viewing the source code of the page where the associated entity exists. You can do this by opening the page and then CTRL+N to enable you to see the IE Toolbar. Click View/Source and do a search for the entity in question and then look for the part of the source where the entity is preceded by “area.”

 /*********************************************************************/

function GetFrameSource(tabSet)

{
  if (crmForm.ObjectId != null)
    {
        var oId = crmForm.ObjectId;
        var oType = crmForm.ObjectTypeCode;
        var security = crmFormSubmit.crmFormSubmitSecurity.value;
        return “areas.aspx?oId=” + oId + “&oType=” + oType + “&security=” + security + “&tabSet=” + tabSet;
    }
    else
    {
        return “about:blank”;
    }
}

crmForm.all.IFRAME_Products.src = GetFrameSource(“areaExistingProducts”);

/*********************************************************************/

9 Responses to “Dynamics CRM 4.0: Placing an Associated View in an iFrame”

  1. Hans says:

    Hi,

    Great to see this work.. If I have a many to many relationship it does not seem to work. What has to be changed / Is this possible?

  2. There is some blog verbiage out there that goes over the process to follow when generating a N:N iFrame. Here’s one example from the MSCRM Unleashed website:

    http://mscrm4ever.blogspot.com/2009/04/crm-40-many-2-many-iframe-viewer.html

    Hope this helps.

  3. Scott says:

    I seem to see a performance hit as soon as I add the iFrame onLoad script. Is there anyway to speed up rendering on the form view?

  4. Rollup 6 contains some performance enhancement functionality. I would go ahead and install the most recent rollup (they are cumulative):

    http://www.dynamicscare.com/blog/index.php/microsoft-has-released-update-rollup-7-for-dynamics-crm-4-0/

    See if that helps.

  5. Wasekh says:

    Is it possible to display only phone call entity in and IFRAME ?

    • I’ve never actually done that, but as long as you’re referencing an existing Associated view, it should be possible. So for example, if you’re trying to add an iFrame of Phone Calls to the Account screen, you would reference the “Account_Phonecalls” relationship in the code.

  6. Yasser Ghonimy says:

    I need to know how to do this iframe with a new custom entity with a 1-many relation with the contact.

  7. [...] doing so, there are already some good samples in Internet that we can take as reference, like this one by DynamicsCare, this one from Jim Wang and this one from Bill [...]

  8. [...] doing so, there are already some good samples in Internet that we can take as reference, like this one by DynamicsCare, this one from Jim Wang and this one from Bill [...]

Leave a Reply

*
*