top of page

Open forms, views, dialogs and reports with a URL (Deprecated)




Please go to the new Post for Open a Form from Javascript according to Microsoft Update.

CRM 2015 – Javascript – Opening an Entity Form from Javascript

Digging in the JavaScript to create my own framework that will make my live and my colleagues live easier. Sometimes we need to open entity records windows, and the most common way of doing that if you ask a JavaScript developer is window.open.  However, as best practices Microsoft says to use the CRM own framework to do that. So, instead of doing: function openDialogProcess(dialogId, entityName, objectId) { var url = Xrm.Page.context.getClientUrl() + "/cs/dialog/rundialog.aspx?DialogId=" + dialogId + "&EntityName=" + entityName + "&ObjectId=" + objectId; window.open(url); } Do: Xrm.Utility.openEntityForm("account","A85C0252-DF8B-E111-997C-00155D8A8410"); More detail about what you can do: From: https://msdn.microsoft.com/en-us/library/72a66f93-92df-42b9-a8fd-b6125c7fe83b#BKMK_OpenEntityForm Opens an entity form.






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

ParametersnameType: String

Required: The logical name of an entity.idType: 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.parametersType: 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:

  1. Form id: To set the id value of the main form to use when more than one form is available. The parameter is formid.

  2. Default field ids: To set default values for a new record form. For more information, see Set field values using parameters passed to a form.

  3. The navbar and cmdbar parameters described in Query String Parameters for the Main.aspx Page.

  4. Custom query string parameters: A form can be configured to accept custom query string parameters. For more information, see Configure a form to accept custom querystring parameters.

Remarks: Using this function helps ensure that users are not prompted to log in again under certain circumstances.

ExamplesOpen 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 = "b053a39a-041a-4356-acef-ddf00182762b";
parameters = "Test";
parameters = "(425) 555-1234";
Xrm.Utility.openEntityForm("account", null, parameters);
0 views0 comments

Recent Posts

See All
bottom of page