Tuesday, July 31, 2012

Xrm.Utility Reference Microsoft Dynamics CRM 2011

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

Microsoft has introduce a new Xrm reference. These functions are available in every application page that supports script.
The functions are below
 
Function
Description
openEntityForm
Opens an entity form
openWebResource
Opens an HTML web resource.

1. openEnityForm
Use to open an entity.

Syntax
Xrm.Utility.openEntityForm(name,id,parameters)

Examples:
Open a new account record
Xrm.Utility.openEntityForm("account");
Open an existing account record
Xrm.Utility.openEntityForm("account","A85C0252-DF8B-E111-997C-00155D8A8410");
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
Note
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");
newWindow.moveTo(0,0);
newWindow.resizeTo(800,600);

2. openWebResource

Opens an HTML web resource.

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

Examples:
1.     Open an HTML web resource named “new_webResource.htm”:
Xrm.Utility.openWebResource("new_webResource.htm");
2.     Open an HTML web resource including a single item of data for the data parameter”
Xrm.Utility.openWebResource("new_webResource.htm","dataItemValue");
3.     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");
Open an HTML web resource, setting the height and width:
Xrm.Utility.openWebResource("new_webResource.htm", null, 300,300);


1 comment:

  1. Interesting post. thanks for sharing helpful information with us. Appconsultio is an app development company in Mumbai that empowers endless Development to make a comprehensive, practical future. From concept to launch, we pride ourselves on delivering cutting-edge solutions that empower businesses to thrive in the digital landscape.

    ReplyDelete