New Xrm.Utility Functions in Update Rollup 8 for Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online.

Xrm.Utility Reference
The Xrm.Utility object provides a container for useful functions not directly related to the current page.
These functions are available in every application page that supports scripting. You can use them in form scripts or in ribbon commands. For HTML web resources, they are available when you include the ClientGlobalContext.js.aspx page. For more information, see ClientGlobalContext.js.aspx.


The following table lists the functions of Xrm.Utility.

Function Description
openEntityForm Opens an entity form.
openWebResource Opens an HTML web resource.


Opens an entity form.



  • name
    • Type: String
    • Required: The logical name of an entity.
  • id
    • Type: String
    • Optional: The string representation of a unique identifier or the record to open in the form. If not set, a form to create a new record is opened.
  • parameters
    • Type: Object
    • Optional: A dictionary object that passes extra query string parameters to the form. Invalid query string parameters will cause an error.Valid extra query string parameters are:

Return Value: Window object.

Remarks: This function provides a better developer experience than the process of manipulating the URL passed to the method described in Open Forms, Views, and Dialogs with a URL. Using this function also helps ensure that users are not prompted to log in again under certain circumstances.


Open a new account record


Open an existing account record


Open a new account record with a specific form and setting default values

var parameters = {};
parameters["formid"] = "b053a39a-041a-4356-acef-ddf00182762b";
parameters["name"] = "Test";
parameters["telephone1"] = "(425) 555-1234";
Xrm.Utility.openEntityForm("account", null, parameters);

Open a new contact record, move it to the top left corner of the screen, and set the size of the window


You cannot use window object methods such as moveTo or resizeTo in scripts that will run in Microsoft Dynamics CRM for Microsoft Office Outlook.

var newWindow = Xrm.Utility.openEntityForm("contact");


Opens an HTML web resource.

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


  • webResourceName
    • Type: String
    • Required: The name of the HTML web resource to open.
  • webResourceData
    • Type: String
    • Optional: Data to be passed into the data parameter.
  • width
    • Type: Number
    • Optional: The width of the window to open in pixels.
  • height
    • Type: Number
    • Optional: 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 webResourceNameparameter.


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


Open an HTML web resource including a single item of data for the data parameter”


Open an HTML web resource passing multiple values through the data parameter

var customParameters = encodeURIComponent("first=First Value&second=Second Value&third=Third Value");


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:


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);
This entry was posted in MS CRM 2011 and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *