Dynamics Monster Limited

By: Pedro | April 10, 2015

Opening a form where you can say if it will open on the same window or another window it will be possible on the Microsoft Dynamics CRM Online 2015 Update 1.


In old times you would use the window.open, but my Microsoft and say as well as a best practice you should use the Xrm.Utility (client-side reference).


Now it will be possible to pass if you want to open on the same window or in a new window as you can see from the below information that i took from the MSDN.



Opens an entity form for a new or existing entity record using the options you set as parameters.

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

 

Name Type Required Description

name

String

Yes

The logical name of the entity.

id

String

No

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

Object

No

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:

windowOptions

Object

No

For Microsoft Dynamics CRM Online 2015 Update 1 or later use this optional parameter in the web application to control how the form opens. You can choose to open a form in a new window by passing a dictionary object with a boolean   openInNewWindow   property set to   true .

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

Examples
Open a new account record using the default form

Xrm.Utility.openEntityForm( "account" ); 
Open an existing account record using the default form

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 account record using the default form in a new window

  var   windowOptions = { openInNewWindow: true };Xrm.Utility.openEntityForm( "account" , null , null ,windowOptions); 

Hope it helps.

Category: CRM 2015 

Tags: Javascript 

Comments:

lsoedl

Posted on : January 19, 2018

Nice aritl


Post a Comment