locked
Popping of an existing record in MS CRM 2013. RRS feed

  • Question

  • Hi Folks,

    I have a question regarding popping of an existing record given the record id in CRM 2013.(Using window.top.location.href)

    The parent entity has a lookup field "hppscm_docketapplication" which points to "hppscm_docketapplication" entity. According to the requirement, there is a button (HTML web resource) on the parent entity form. On click of the button, the look entity record "hppscm_docketapplication" should pop up. 

    I have used the below code.

    var serverUrl = parent.Xrm.Page.context.getServerUrl();
                    var docketApplicationUrl = serverUrl + "/main.aspx?etn=hppscm_docketapplication&pagetype=entityrecord&id=" + docketApplicationId + " ";
                    alert(docketApplicationUrl);
                    window.top.location.href = docketApplicationUrl;
                    //window.open(docketApplicationUrl);
                    //window.location.assign(docketApplicationUrl);
                    //top.location.href = docketApplicationUrl;

    I tried each of the last four lines to pop the correct record. But I am unable to pop up the lookup entity record. Wat happens is that the current parent record refreshes or current parent record opens in a new window(in case of window.open). It is taking the current session's parent record.

    The lookup record url "docketApplicationUrl" which is formed is working correctly. If I go to the docketApplicationUrl, the lookup entity record opens. 

    Please provide your inputs.

    Kind Regards,

    Rameshwari


    Tuesday, October 8, 2013 5:33 AM

Answers

  • Hi Guys,

    Got the answer for the above . 

    Used the following to pop the entity record:

    parent.Xrm.Utility.openEntityForm("hppscm_docketapplication", docketApplicationId);

    Still would like to know the answer if I could pop the existing records using the script written in the above mail (using window.open ??)

    Kind Regards,

    Rameshwari

    • Marked as answer by RameshwariSah Tuesday, October 8, 2013 7:48 AM
    Tuesday, October 8, 2013 7:43 AM

All replies

  • Hi Guys,

    Got the answer for the above . 

    Used the following to pop the entity record:

    parent.Xrm.Utility.openEntityForm("hppscm_docketapplication", docketApplicationId);

    Still would like to know the answer if I could pop the existing records using the script written in the above mail (using window.open ??)

    Kind Regards,

    Rameshwari

    • Marked as answer by RameshwariSah Tuesday, October 8, 2013 7:48 AM
    Tuesday, October 8, 2013 7:43 AM
  • Hi,

    Like Rameshwari said, if I use window.open in CRM 2013 with name parameter = _top it only refreshes the  entity from where I had called the webresources that contains window.open. If I use window.open without name parameter it opens the calling entity in new form. Not the one which guid is in the URL ( URL like https://myorg.mydomain.fi/main.aspx?etn=account&pagetype=entityrecord&id=a72b0802-272f-e311-b533-00155d001723).

    Interesting point is that if I try open a existing entity from entity form into the new window using window.open it reopens the entity from where I called the window.open. Then if I push Cntrl+N it navigates automatically to the entity which it should have been navigate at first place. Does someone have an idea why it works like this?

    This could be tested with "Create dependent OptionSets" samlpe which is in CRM 2013 SDK. Just Import the solution and try to use "Open ticket form" button in configurations page. It opens Solutions window (which is not what it suppose to do) but if You then push Cntrl+N it navigates to Ticket entity like it should be.

    Jani 

    Friday, October 11, 2013 2:35 PM
  • Hi Jani,

    i spent 2 days trying to get rid of the same problem you had.
    Did you finally managed to solve this issue ?

    Can you open an existing record correctly from another entity form ?

    I will be very happy if you can share your solution 

    Thanks in advance

    Stefano

    Tuesday, November 12, 2013 5:35 PM
  • Create URL

    var randomnumber = 100000000 + Math.floor(Math.random() * 900000000);
        var url = baseUrl + "main.aspx?etn=" + enityLogicalName + "&extraqs=&histKey=" + randomnumber + "&id={" + guid + "}&newWindow=true&pagetype=entityrecord";
        window.open(url, "", "status=0,resizable=1,width=1000px,height=600px");


    Tuesday, December 10, 2013 12:39 PM
  • You still can do it with window.open but instead of using "/main.aspx?" you should use "/CRMReports/viewer/drillopen.aspx?" parameters are LogicalName and ID  where LogicalName is the EntityLogicalName and ID is the ID of the entity record.

    This URL is the one used in Action parameters in Reports that is passed through the CRM_URL parameter from the report viewer.

    Friday, January 10, 2014 6:42 PM
  • Try this:

    window.open(Xrm.Page.context.getClientUrl() + "/main.aspx?etn=account&extraqs=&histKey="+ Math.floor(Math.random() * 10000) +"&id=" + yourRecordIdHere + "&newWindow=true&pagetype=entityrecord", "", "status=0,resizable=1,width=1000px,height=600px");

    • Proposed as answer by Ahmad Pirani Thursday, March 6, 2014 4:44 PM
    Thursday, March 6, 2014 4:43 PM