RSS

Open Dialog box like CRM 2013

23 Apr

Introduction

In this Blog, we will explore how to open a Dialog Box similar with CRM 2013 look and feel.

Background

Sometimes, we need to open the custom WebResource in a Dialog Box. But the Dialog Box should look like other Dialog Box in CRM 2013.

Custom Dialog Box

Solution

We can achieve this by one CRM function in the following way:

Note: Here, URL must be without Server URL.

For the Parent Window:

var DialogOption = new Xrm.DialogOptions;
DialogOption.width = <Height>; DialogOption.height = <width>;

Xrm.Internal.openDialog(<Relative_Url_of_the_Webresource>, 
                        DialogOption, 
                        null, null, 
                        CallbackFunction);

function CallbackFunction(returnValue){ }

In the Dialog Box, please include:

<script type="text/javascript" 
        src="../../../../../../webresources/ClientGlobalContext.js.aspx"></script>
/*This Might change according to the url*/

And

//Pass the return Value to the parent window
Mscrm.Utilities.setReturnValue(oReturn);

try {
    closeWindow(true);//Close the dialog box
}
catch (e) { }

By Sukant Shekhar
Senior Software Engineer @Team DynamicsCRM.
Mindfire Solutions

Advertisements
 

Tags: , , , , , , , , , , , , , , , , ,

5 responses to “Open Dialog box like CRM 2013

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: