top of page

CRM 2015 – Javascript – Closing a CRM Form in Javascript




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.

#Javascript

1 view0 comments

Recent Posts

See All
bottom of page