Recently in my project, I came across a requirement where the customer would launch the quick create form and when he clicks on the Save button, our CRM system would perform complex business functions and show a pop-up to the user with a list of available options. If the user selects one of the options from the pop-up, our requirement was to close out the Quick Create form without saving the record.
Our initial guess was to try out the Xrm.Page.ui.close() to close the global quick create form. However that didn’t work.
After quite a bit of exploring the CRM system libraries, finally I could find out a way. CRM uses the .js file GlobalQuickCreateBehavior.js to perform all functions related to Quick Create. The file is located in
<CRM Installation folder>/CRMWeb/_static/_controls/GlobalQuickCreate folder.
A little bit of formatting the .js file and voila you have all the wonderful functions that CRM uses for its Quick create Functionality. Just a quick glance below.
Since this article is all about closing the Quick Create Form, let us quickly explore the function that we need. The following is the screenshot of the function that you can use to close your Quick Create Form.
All you need is to call the highlighted function Mscrm.GlobalQuickCreate.GlobalQuickCreateBehavior.closeAllGlobalQuickCreateForms() to close the Quick Create Dialog and you are done.
Please note: this is a system function and any changes done by Microsoft Team in the library would render your code un-usable.
Hope this helps!