Open Dialog Box in CRM 2013/2015

Hi,
 
Today we got a requirement to get the address from some external system and show them as popup to the user. User selects one of the addresses and we need to do some business operation based on the selection.
 
The challenge is to show the UI like CRM windows so that the user will not see any difference in the UI.
 
After some search came to know that we can do this using XRM Javascript and it is very simple too.
 
Create a HTML webresource and design it as per your requirement.
Make sure you include the reference of ClientGlobalContext.js.aspx in the webresource.

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


Call the web resource using the following code.

var vDialogOption = new Xrm.DialogOptions;

// Set height and width of the window
vDialogOption.width = 100; DialogOption.height = 100;
 
Xrm.Internal.openDialog(“Relative_Url_of_the_Webresource”, DialogOption, null, null, CallbackFunction);

On the button click, you can also return values from Popup.
 

//Pass the return Value to the parent window

Mscrm.Utilities.setReturnValue(oReturn);
 

Hope this helps

Happy CRM’ing
Gopinath

One thought on “Open Dialog Box in CRM 2013/2015

  1. Unknown September 3, 2015 / 5:51 am

    Simple yet very usefull. Thank you.

    Like

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s