Wednesday 4 December 2013

how to refresh parent ms crm 2011 form on child aspx custom page close?

Issue:

I have button custom button in contract entity ribbon area. (MS CRM 2011).

In that button click I am opening an .aspx page through “window.showModalDialog”.

In the .aspx I want to access the contract entity record some attributes to set values for it.

But I am unable to access the CRM from.

I have tried like
window.parent.opener.Xrm.Page.data.entity.attributes.get('iaah_cohortyesclicked').setValue('yes');

window.top.opener.document.getElementById("'iaah_cohortyesclicked'").value = "value";

It is not working.


Solution:

In the contract entity javascript where I am opening the window.showModalDialog

Now I am passing the CRM form windows object as parameter to showModalDialog.

//In javascript

window.showModalDialog(strSourceURL,window, "dialogHeight:200px;dialogWidth:550px;center:yes; resizable:0;maximize:0;minimize:0;status:no;scroll:no");

Before I was opening the dialog as

window.showModalDialog(strSourceURL,null, "dialogHeight:200px;dialogWidth:550px;center:yes; resizable:0;maximize:0;minimize:0;status:no;scroll:no");


Instead of null I am passing window.


Now I can able to access the CRM form attributes in my .aspx page.

Like

var parentWindow = window.dialogArguments;

parentWindow.Xrm.Page.data.entity.attributes.get('iaah_cohortyesclicked').setValue('yes');

 

No comments:

Post a Comment