Quantcast
Channel: Microsoft Dynamics CRM
Viewing all articles
Browse latest Browse all 123975

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

$
0
0
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="http://www.w3.org/1999/xhtml" >
    <head>
    <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">

    //debugger;

    //get the context
    var Xrm = window.parent.Xrm;

    //get the current object id
    var oId = Xrm.Page.data.entity.getIdundefined);

    //get the object type
    var oType = Xrm.Page.context.getQueryStringParametersundefined).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.prependOrgNameundefinedsUrl);

    window.location = relativeUrl;

    </script>
    </head>
    <body>
    </body>
    </html>
  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.

    image
  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.

    image
  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.

    image
Happy 2013 everyone.

Viewing all articles
Browse latest Browse all 123975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>