How to create an embedded dialog in MS CRM 2013

MS CRM 2013 introduced a new approach to dialog boxes open inside the system. In versions of 2011, search queries were opened as separate (modal) windows, but in 2013, search queries opened as embedded iframes on the current page.

This is definitely possible with the following jQuery statements:

$('body').append("<div id='InlineDialog_Background' class='ms-crm-InlineDialogBackground' tabindex='0' style='position: absolute; width: 100%; height: 100%; top: 0px; background-color: rgb(128, 128, 128); z-index: 1005; opacity: 0.5;'></div>");
$('body').append("<div id='InlineDialog' class='ms-crm-DialogChrome' tabindex='1' style='position: absolute; top: 50%; left: 50%; z-index: 1006; margin-top: -240px; margin-left: -400px; height: 540px; width: 800px;'><iframe id='InlineDialog_Iframe' name='InlineDialog_Iframe' src='custom_url' style='height: 540px; width: 800px; border: 0px;'></iframe><div id='DialogLoadingDiv' style='position: absolute; background-color: white; height: 480px; width: 800px; top: 50%; left: 50%; margin-top: -240px; margin-left: -400px; z-index: 1007; display: none;'><table class='ms-crm-LoadingContainer' style='width:100%;height:100%'><tbody><tr class='ms-crm-LoadingContainer'><td style='vertical-align: middle' align='center'><img id='DialogLoadingDivImg' alt='' src='/_imgs/AdvFind/progress.gif'><br>Loading...</td></tr></tbody></table></div></div>");

However, closing this dialogue also requires some additional procedures.

Are there any methods provided by Microsoft javascript to open this iframe?

+4
source share
3 answers

Here is an example of displaying a web resource in such a dialog box.

In the parent window:

var src = <Relative_Url_of_the_Webresource>;
var DialogOptions = new Xrm.DialogOptions(); 
DialogOptions.width = 500;
DialogOptions.height = 400;
Xrm.Internal.openDialog(src, DialogOptions, null, null, CallbackFunction);

function CallbackFunction(returnValue){ }

, ClientGlobalContext.js.aspx -, :

<script type="text/javascript" src="/webresources/ClientGlobalContext.js.aspx"></script> 

:

Mscrm.Utilities.setReturnValue(result);
try {
    closeWindow(true); //Close the dialog box
}
catch (e) { }
+7

, , , - http://a33ik.blogspot.com/2014/05/show-your-dialog-in-crm-2013-modal-style.html

:

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
    };
}

:

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

There is no supported way to open search dialogs programmatically.

The Dynamics CRM 2013 SDK lists supported search management methods:

  • addCustomFilter
  • addCustomView
  • getDefaultView
  • setDefaultView

You can also add preliminary search events.

+1
source

Source: https://habr.com/ru/post/1540511/


All Articles