web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Dynamics Monster / CRM 2015 - Javascript - Clo...

CRM 2015 - Javascript - Closing a CRM Form in Javascript

Dynamics Monster Profile Picture Dynamics Monster 471


I had the need of adding an additional button to a form "Submit and Close" for business process purposes.


In there doing some code, in the end only needed to call to do whatever i needed:


Xrm.Page.data.entity.save("saveandclose");

Xrm.Page.ui.close();


However, doing that, and because i was calling the for from a Web Resource, the form was being closed but the originating web resource was appearing, the solution is simple, change the last line by:


if (parent.opener != undefined) { window.parent.close(); } else Xrm.Page.ui.close();


In my perspective, it seems that CRM if has a parent.opener, just redirects to that location, even if we are calling the close of the window trough the Xrm.Page.Ui object.


Any thoughts, please let me know.


Hope is useful.



Comments

*This post is locked for comments