How to Refresh the parent Form in CRM Dynamics 5.0

2019-06-26 13:08发布

问题:

I have a parent form called ISSUE. This Issue form has a button called IG on the Form Ribbon that opens custom Html Page.

Now after the Submit button is clicked on the Custom form that performs some Inserts into CRM and Closes directly. Now I want to refresh the parent ISSUE form on closing the child HTML Page to reflect my Inserts.

Here is the code that i used to call the Child Form on clicking IG Button from the Issue Form Ribbon:

function popup()
{
    var url = './WebResources/irpc_/planner.html';

    var data =
    {
        issueGuid: Xrm.Page.data.entity.getId(),
        causeCodeGuid: Xrm.Page.data.entity.attributes.get("irpc_causecode").getValue()[0].id,
        riskClassificationId: Xrm.Page.data.entity.attributes.get("irpc_riskclassification").getValue()
    };

    window.showModalDialog(url , data, 'dialogHeight:480px;dialogWidth:1200px;');

}

Appreciate your help.

Thanks

回答1:

You could try:

window.location.href = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search

This will input the same URL minus the hash/fragment. I'm assuming CRM 5 still uses a fragment which would prevent the page from refreshing if you just did a window.location.href = window.location.href.

Caveats:

  1. If there is dirty data on the form, you're going to get a dirty data warning.


回答2:

 well, you can use the following line of code.

 window.location.reload(true);