Skip Ribbon Commands
Skip to main content

Brite Global Blogs




Connect with Brite Global


Like us on Facebook, add us to your LinkedIn network, view our videos on YouTube or subscribe to our blog.

Facebook Linked In You Tube Blog and RSS
Sep 20
Open Entity Form with the new Xrm.Utility object

Update Rollup 8 for Microsoft Dynamics CRM 2011 was released in May 2011, but an updated SDK was not provided with the rollup.

The Xrm.Utility objet provides a container for a couple of useful functions, that are available in every page that supports scripting. These functions can be used from form scripts or ribbon commands.

The Open Entity Form function opens and entity form as shown in the syntax below:

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

The following is a description of the function parameters:

name – The logical name of the entity (such as account)

id – The string representation of the unique identifier of the entity records to open.
If the id parameter is left empty, then this is a new form

parameters – a dictionary object that passes extra query string parameters to the form
The valid extra query string parameters include form id, default field ids and custom query string parameters.

The return value from calling the Open Entity Form function will be a Window object.

The following examples show how to open an entity form:

// Open a New Contact Form
Xrm.Utility.openEntityForm("contact");

// Open an Existing Contact form for the provided Contact Unique Identifier
Xrm.Utility.openEntityForm("contact", "10C52A16-1198-42AB-99CB-A3E83601BE72");

// Open a New Contact Form for the selected form and prepopulate the provided parameters
var parameters = {};
parameters["formid"] = "13FFAD4D-11EF-44A0-875B-9A4D8D741C17";
parameters["firstname"] = "John";
parameters["lastname"] = "Smith";
Xrm.Utility.openEntityForm("contact", null, parameters);

The reason that the Xrm.Utility functions were created was due to the issues that the window.open would prompt for user login credentials.
Calling the Xrm.Utility functions opens a new unathenticated process.

Comments

There are no comments for this post.
Powered By SharePoint 2013