Sunday, January 6, 2013

Step by step tutorial to add the missing associated views to a CRM form.

In my last blog, I have posted the URL to add the navigation link for the relationships missing in the relationship explorer. I was in a hurry and did not explain how the URL can be used to add associated view to the form navigation. This blog will explain all the URL parameters and a step by step guide to achieve it.
URL Parameters
Here is the URL to display the associated view.
http://servername/orgname/userdefined/areas.aspx?oId=<guid of the entity>&oType=<entity type code>&pagemode=iframe&security=852023&tabSet=<relationship schema name>
The URL has following parameters
  1. oId: This parameter represents the guid of the entity opened in the form.
  2. oType: This parameter represents the entity type (object type code) of the entity
  3. pagemode: This parameter is static. pagemode=iframe means that this view will be displayed like an iframe and there will be no ribbon displayed for this view. The system will display a context ribbon when user selects the associated view grid.
  4. security: This parameter is also static. I am not changing this value.
  5. tabSet: This parameter represents the schema name of the relationship.
Here are all the steps to add the associated view to the form navigation.
  1. Create a HTML web resource. I named my web resource “AssociatedView.HTML”. Here is the code for the web resource.
    <html xmlns="" >
        <title>Untitled Page</title>
        <style type="text/css">html,body{font-family: Segoe UI, Tahoma, Arial;background-color: #d6e8ff;border: 0px; margin: 0px; padding: 0px;}</style>
        <script type="text/javascript" language="javascript">
                //get the context
                var Xrm = window.parent.Xrm;
                //get the current object id
                var oId =;
                //get the object type
                var oType = Xrm.Page.context.getQueryStringParameters().etc;
                //set Relationship Name
                var relName = "lead_owning_user";
                //building a url
                var sUrl = "/userdefined/areas.aspx?oId=" + oId + "&oType=" + oType + "&pagemode=iframe&security=852023&tabSet=" + relName;
                //get relative path with orgname as required
                var relativeUrl = Xrm.Page.context.prependOrgName(sUrl);
                window.location = relativeUrl;
  2. The only thing you need to change is the relationship name field. To do that open the entity relationships and get the schema name of the relationship. The following screen shot is displaying the relationship between user and lead entity. The user can be the owner of multiple leads.

  3. Update the JavaScript in the HTML web resource. Save and publish the web resource.
  4. Open the entity form and click on navigation button. Then select the “navigation link” as shown in the following screen short.

  5. The system will display the “Navigation Link Properties” dialog as shown in above screen shot. Enter the name for the navigation link. Choose an Icon and choose the web resource created in step 1 of the tutorial. Save the changes and publish the form.
  6. Open the form. The result will look like the following screen.

Happy 2013 everyone.


  1. Your code contains small typos:
    "(" was replaced by "undefined"

    var oId =;
    var oType = Xrm.Page.context.getQueryStringParameters().etc;
    var relativeUrl = Xrm.Page.context.prependOrgName(sUrl);

  2. Thanks mate. I have updated the code.

  3. Hi, I am trying to implement this, however when I click on the final navigation link I just get a blank blue page. Any ideas?

  4. Nevermind, I must've had a typo in there. It's still not working for me though. I see the sub-grid now, but it is not displaying any leads.

    1. That's good. It depends if the records exist for the relationship.

    2. I had browse the url in separate window. Getting error. I want to show the subgrid in crm main page using iframe..?

  5. This isn't working for me either, all I get is a blue screen.

  6. worked ! but there is no ribbon bar ( CRM 2015)

  7. No ribbon bar on crm 2013

  8. Hi,
    We are trying to display associated view in iFrame on Entity form in CRM 2016 version.
    We could do that using the same format as the following url:
    We are getting one issue, i.e,
    In iFrame, Command bar of associated view (with rof=false&inlineEdit=1) does not show up.
    Can you provide some help on this?