locked
CRM 2013: Supported way to display dialogs RRS feed

  • Question

  • What is the supported way to display an HTML webresource as a dialog ?

    I have tried Xrm.Utility.openWebResource(webResourceName) but it's displayed as a webpage

    Thanks

    Monday, December 16, 2013 3:45 PM

All replies

  • The SDK doesn't provide a supported method to handle this - so you might have to use something like showModalDialog.

    http://thinkingincrm.blogspot.com/2013/07/open-html-web-resource-page-in-modal.html


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Monday, December 16, 2013 4:16 PM
    Moderator
  • Is it supported ?
    Monday, December 16, 2013 8:56 PM
  •  You should be able to use something like this, but you need to look at the way IE opens new windows, because sometimes it can open them in a new tab, which is probably not what you want. I use a html container to host the dialog in an iframe.

           openDialog: function (dialogid, entityname, objectid, callback) {
                if (objectid.length > 36) objectid = objectid.substr(1, 36);
                //format the url access to dialog
                var dlgUrl = String.format('{0}/cs/dialog/rundialog.aspx?DialogId=%7b{1}%7d&EntityName={2}&ObjectId=%7b{3}%7d',
                  Xrm.Page.context.getClientUrl(), dialogid, entityname, objectid);
                // add the callback function.toString to the querystring
                if (callback) dlgUrl += '&callback=' + JSON.stringify({ fnc: callback }, function (key, value) { return (typeof value === 'function') ? value.toString() : value; });
                var dlg = Xrm.Utility.openWebResource('xxx_container.htm', encodeURIComponent(dlgUrl), 620, 510); //open container webresource
                return dlg;
            }

    • Proposed as answer by Chris_Cohen Tuesday, January 21, 2014 8:34 AM
    Monday, December 16, 2013 9:15 PM