It's a common requirement to display an associated view on a CRM form to make it easier for the user seeing relevant data on one screen, rather than clicking through the associated views. While it's straightforward what to do (placing an IFRAME on the form), there's still one question being asked over and over: what is the correct URL for this IFRAME?

I already posted the code you need in the OnLoad script (see What value to pass in the security parameter?), but the name of the tabSet parameter is not always obvious. Here's a very easy technique to get it.

The screenshot above is the associated contact view of an account. Say you want to display it in an IFRAME on the account form itself and need the correct URL. To get it, simply type in javascript:alert(document.frames[1].location) in the address bar. If you don't see the address bar, press F11 or CTRL-N.

While in the address bar, hit Enter to execute the command:

You only need the value of the tabSet parameter, because everything else is described in the article mentioned at the top of this page. However, it sometimes is a long name and if you're as lazy as I am, press CTRL-C (the usual shortcut for a copy operation), open an editor and paste the clipboard's content:

---------------------------
Windows Internet Explorer
---------------------------
http://dc:5555/sw/sfa/accts/areas.aspx?oId=%7bFCB154A5-E9DF-DC11-BA3C-0017316CFA5A%7d&oType=1&security=852023&tabSet=areaContacts
---------------------------
OK
---------------------------

You now have everything in place and can easily display the associated view in your IFRAME (again, look at What value to pass in the security parameter? for a walkthrough).

Update 20.05.2008

The link is slightly different when displaying a many:many relationship. For instance:

http://crm4dev:5555/Stunnware/userdefined/areas.aspx?oId=%7bC002A64B-A592-DC11-A5E5-0003FFE97DC8%7d&oType=10001&security=65591&roleOrd=1&tabSet=areasw_lookuptemplatedefinition

The roleOrd parameter seems to specify which side of a many:many relationship to show. To be compatible with many:many relationships, I extended the GetFrameSource function:

function GetFrameSource(tabSet, roleOrd) {

    if (crmForm.ObjectId != null) {

        var roleOrdParamMissing = (typeof(roleOrd) == "undefined") || (roleOrd == null);

        var oId = crmForm.ObjectId;
        var oType = crmForm.ObjectTypeCode;
        var security = crmFormSubmit.crmFormSubmitSecurity.value;

        var url = "areas.aspx?oId=" + oId + "&oType=" + oType + "&security=" + security + "&tabSet=" + tabSet;

        if (!roleOrdParamMissing) {
            url += "&roleOrd=" + roleOrd;
        }

        return url;
    }

    else {
        return "about:blank";
    }
}

You can call GetFrameSource with one or two parameters, so it should work with 1:many and many:many relationships.