Archive

Posts Tagged ‘Xrm.Utility’

Xrm.Utility is undefined error – CRM 2011

Other day when I deployed my solution on a new CRM server, I was getting “Xrm.Utility is undefined” script error.

I refered“Xrm.Utility” JScriptin my code to open forms which was causing script issue.

Reason & Fix

  • The CRM server is not having UR 8
  • Since Xrm.Utility object was added in CRM 2011 Update Rollup 8, installing UR 8 on server solved the issue

🙂

Xrm.Utility functions to open Entity forms or Web resources

November 1, 2012 1 comment

In CRM, we can open the entity forms using “window.open” method

  • With UR 8, a couple new client-side JavaScript functions were added to open entity forms and web resources
  • These functions fixes the prompt the user to login again issue when you use “window.open” to open form or web resource from CRM online/Outlook client

Xrm.Utility

The Xrm.Utility object provides a container for useful functions. Following MSDN blog which talks extensively on the same

For quick glance below are few samples

Open a new “Account” record form

Xrm.Utility.openEntityForm(“account”); // Pass ‘Account’ schema name

Open an existing “Account” record form

Xrm.Utility.openEntityForm(“account”,”A85C0252-DF8B-E111-997C-00155D8A8410″); // Pass ‘Account’ schema name & GUID

Open a new “Account” record 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 an HTML web resource named “new_webResource.htm”

Xrm.Utility.openWebResource(“new_webResource.htm”);

🙂