locked
How to open a record in new window in crm 2013 RRS feed

  • Question

  • If there are two related entities (Ex: contact and custom entity) and opened the custom entity's record from contact entity. Now if the user wanted to see some details present in the Contact entity then on click of the related lookup field it is opening the contact record in the same window. However user is unable to open the same custom entity record again. To solve this problem, if the contact record is opened in a new window. How can we achieve this??

    One solution we found that is keeping a Ribbon button and writing a Javascript. So that on click of the button it opens the contact record.

    Our client requested for the better approach like "On click of the related lookup field, open the contact record in new window. Is this possible. If not is there any other better way to achieve??

    We are using IE8 and IE9 browsers to open CRM.

    Thanks in advance.

    Monday, November 17, 2014 10:54 AM

All replies

  • Hi,

    I shared it in my blog. CRM 2013 Open Entity Form in new Window by JavaScript

     Also here is the code. It works all the browsers

    function OpenRecords(Record_Id, Logical_Name_Of_Entity) {
     var reletivePath = "main.aspx?etn=" + Logical_Name_Of_Entity;
     reletivePath = reletivePath + "&pagetype=entityrecord&id=";
     
     var height = 1300; // Height of the Record Page.
     var width = 900; // Width of the Record Page.
     var windowName = "_blank";
     var serverUrl = Xrm.Page.context.getServerUrl();
     var nAgt = navigator.userAgent;
     
     if (serverUrl != null && serverUrl != ""
     &&
     Record_Id.replace("{", "").replace("}", "") != null) {
     serverUrl = serverUrl + "/"+ reletivePath;
     serverUrl = serverUrl + Record_Id.replace("{", "").replace("}", "");
     
     if (nAgt.indexOf("Firefox") != -1) {
     window.open(serverUrl);
     } else {
     window.openStdWin(serverUrl,
     null,
     height,
     width,
     "titlebar=yes, resizable=yes");
     }
     }
    }



    If you find this post helpful then please Vote as Helpful and Mark As Answer. Thanks and Regards, Polat Aydın My blog

    Monday, November 17, 2014 1:11 PM
  • Please have a look at this. Another workaround is to try holding Ctrl + Click on lookup to open in new window.

    Regards, Saad

    Monday, November 17, 2014 1:12 PM
  • Thanks for your quick response. I have already seen this code in your blog. It is very helpful.

    Problem in my case is in which event I can trigger this function. Because there is no event trigger when I click on a lookup field value.

    I have to create a ribbon button or a button in the form using unsupported customization to trigger this function.

    Can you please let me know is there any other way?

    Monday, November 17, 2014 1:24 PM