top of page

CRM 2015 – Javascript – Opening a Web Resource




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

Note 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); 


Hope can help you.
4 views0 comments

Recent Posts

See All
bottom of page