Show Case history of a customer on Case form 

In Dynamics 365, you can see all the tickets related to a customer at a single point under Related ‘Tickets’. It gives a summation of all the tickets and issues faced by that customer. As a user agent, while dealing with the same client, you might need to see all the existing tickets to have a better context and history of any issue. But the journey to reach that point and return to the current screen sometimes swipes you away from the current issue. So, to make the user experience rich, we have suggested a method to have a shortcut as a widget or a link on the ticket creation screen. It maintains the user journey as well as makes it easy for any agent to investigate the history of events.

If we want to view the list of all cases/tickets created for a customer (Account / Contact), it can be viewed in the case associated view on the Account / Contact form as shown in the screenshot below.

In our case, our client requested to place the same associated view as a case history view on the case form as they need it to validate if any duplicate cases are created for the customer and to merge them.

Since there is no supported out-of-the-box feature to show the associated view in a unified interface, we had to work around it, rendering the legacy case sub grid onto case form which would fit our requirement. Let’s see the implementation below.

An associated view of a relationship can be rendered by forming a URL in the following format and the URL parameters are highlighted in orange below.

https://<OrgURL>/userdefined/areas.aspx?oId=<guid of the entity>&oType=<entity type code>&pagemode=iframe&security=852023&tabSet=<relationship shema name> 

OrgURL: Organization URL
oId: Object Id (Contact Guid in our case)
oType: Object type code (2 in our case)
tabSet: Relationship schema name (incident_customer_contacts in our case)

Although the associated view can be rendered onto case form, our client wanted to just have a link to navigate to the view to save some space on case form. And the link to the case history view of customer is implemented using an html web resource as follows.



    <title>Ticket History</title> 

    <style type=”text/css”> 

        html, body { 

            font-family: Segoe UI, Tahoma, Arial; 

            background-color: #d6e8ff; 

            border: 0px; 

            margin: 0px; 

            padding: 0px; 




<body style=”word-wrap: break-word;” onfocusout=”parent.setEmailRange();”> 

        <!– Insert the relativeUrl here –> 

        <!– <a href=”<%=relativeUrl%>”>Link to Ticket History</a> –> 

      <script type=”text/javascript” language=”javascript”>         

            var Xrm = window.parent.Xrm; 

            var globalContext = Xrm.Utility.getGlobalContext(); 

            var lookupitem = new Array; 

            lookupitem = Xrm.Page.getAttribute(“customerid”).getValue();        

            if (lookupitem != null) { 

                var oId = “%7b” + lookupitem[0].id.replace(“{“, “”).replace(“}”, “”) + “%7d” 

                var relName = “incident_customer_contacts”; 

                var sUrl = “/userdefined/areas.aspx?oId=” + oId + “&oType=” + Xrm.Internal.getEntityCode(“contact”) + “&pagemode=iframe&security=852023&tabSet=” + relName + “&rof=true&inlineEdit=1”; 

                var relativeUrl = globalContext.prependOrgName(sUrl); 

                document.write(‘<a target=”_blank” href=”‘ + relativeUrl + ‘ ” >Link To Merge Tickets</a>’); 







The URL with all parameters formed looks as below. 


The link to navigate to the view on the case form and the navigated case associated view are displayed as shown below. 

Ticket History

This view saved our time and effort to navigate to another screen leaving behind the current action page. We can see all the tickets in a fresh window screen and putting a link instead of a widget saves our space on the screen.

Stay in touch for more such awesome use cases and their solutions.