Close Quick Create Form in Microsoft Dynamics CRM 2013.

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.

Know more on how to open CRM system javascript files in readable format? Checkout my post at this URL – https://debajitcrm.wordpress.com/2014/08/05/exploring-microsoft-dynamics-crm-system-js-file/

image

 

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.

image

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!