Development

Show your dialog in CRM 2013 modal style

With CRM 2013, we’ve got one working window without any pop-up windows (lookups, dialogs, e.t.c.). But… only for standard features. What do you do in case you want to use the same approach with the modal windows, as CRM does it? I went through the SDK and found the following article – http://msdn.microsoft.com/en-us/library/jj602956.aspx#BKMK_OpenWebResource. I tried the code but I got wrapped window.open method. After some investigations, I found how CRM does it:
if (typeof Custom == "undefined") {
    Custom = {
        OpenDialog: function (webresource) {
            var $v_0 = new Mscrm.CrmDialog(Mscrm.CrmUri.create(webresource), window, 370, 370, null);
            $v_0.show();
        },
        __namespace: true
    };
}

and the usage is following:

Custom.OpenDialog("/webresources/new_webresource.htm");

Demonstration of what it looks like:

You can use this approach but remember that this code uses undocumented methods, so it could be broken with any rollup.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.