web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Dynamics Monster / CRM 2015 - Javascript - Ope...

CRM 2015 - Javascript - Opening a Web Resource

Dynamics Monster Profile Picture Dynamics Monster 471

Javascript function from the Namespace Xrm.Utility that can be called to open a Web Resource with the possibility of adding parameters. Bare in mind that cannot that this function will not work with Microsoft Dynamics CRM for tablets.  


Xrm.Utility.openWebResource(webResourceName,webResourceData,width, height) 
Parameters

 

Name Type Required Description

webResourceName

String

Yes

The name of the HTML web resource to open.

webResourceData

String

No

Data to be passed into the data parameter.

width

Number

No

The width of the window to open in pixels.

height

Number

No

The height of the window to open in pixels.

Return Value
Window object.

Remarks
An HTML web resource can accept the parameter values described in   Passing Parameters to HTML Web Resources . This function only provides for passing in the optional data parameter. To pass values for the other valid parameters, you must append them to the webResourceName   parameter.

Examples
Open an HTML web resource named “new_webResource.htm”

Xrm.Utility.openWebResource( "new_webResource.htm" ); 
Open an HTML web resource including a single item of data for the data parameter

Xrm.Utility.openWebResource( "new_webResource.htm" , "dataItemValue" ); 
Open an HTML web resource passing multiple values through the data parameter

   var   customParameters = encodeURIComponent( "first=First Value&second=Second Value&third=Third Value" );Xrm.Utility.openWebResource( "new_webResource.htm" ,customParameters); 
noteNote
These values have to be extracted from the value of the data parameter in the HTML web resource. For more information, see   Sample: Pass multiple values to a web resource through the data parameter

Open an HTML web resource with the parameters expected by HTML web resources

Xrm.Utility.openWebResource( "new_webResource.htm?typename=account&userlcid=1033" ); 
For more information, see   Passing Parameters to HTML Web Resources .

Open an HTML web resource, setting the height and width

Xrm.Utility.openWebResource( "new_webResource.htm" , null , 300,300); 

From MSDN: https://msdn.microsoft.com/en-us/library/jj602956.aspx#BKMK_OpenWebResource 

Hope can help you.

Comments

*This post is locked for comments