Xrm.Utility JavaScript methods in Dynamics 365 Version 9.x

Xrm.Utility: 

Method
Description
closeProgressIndicator
Closes a progress dialog box.
Xrm.Utility.closeProgressIndicator()
getAllowedStatusTransitions
Returns the valid state transitions for the specified entity type and state code.
Xrm.Utility.getAllowedStatusTransitions(entityName,stateCode).then(successCallback, errorCallback)
getEntityMetadata
Returns the entity metadata for the specified entity.
Xrm.Utility.getEntityMetadata(entityName,attributes).then(successCallback, errorCallback)
getGlobalContext
Gets the global context.
getLearningPathAttributeName
Returns the name of the DOM attribute expected by the Learning Path (guided help) Content Designer for identifying UI controls in the Dynamics 365 Customer Engagement forms.
Xrm.Utility.getLearningPathAttributeName()
getResourceString
Returns the localized string for a given key associated with the specified web resource.
Xrm.Utility.getResourceString(webResourceName,key)
invokeProcessAction
Invokes an action based on the specified parameters.
Xrm.Utility.invokeProcessAction(name,parameters).then(successCallback, errorCallback)
lookupObjects
Opens a lookup control to select one or more items.
Xrm.Utility.lookupObjects(lookupOptions).then(successCallback, cancelCallback)
lookupOptions: Object. Defines the options for opening the lookup dialog. Has the following properties:
Property Name
Type
Required
Description
allowMultiSelect
Boolean
No
Indicates whether the lookup allows more than one item to be selected.
defaultEntityType
String
No
The default entity type to use.
defaultViewId
String
No
The default view to use.
entityTypes
Array
No
The entity types to display.
showBarcodeScanner
Boolean
No
Indicates whether the lookup control should show the barcode scanner in mobile clients.
viewIds
Array
No
The views to be available in the view picker. Only system views are supported.
successCallback
Function
Yes
A function to call when the lookup control is invoked. An object with the following properties is passed:
entityType: String. Entity type of the record selected in the lookup control.
id: String. ID of the record selected in the lookup control.
name: String. Name of the record selected in the lookup control.
errorCallback
Function
Yes
A function to call when you cancel the lookup control or the operation fails.
refreshParentGrid
Refreshes the parent grid containing the specified record.
Xrm.Utility.refreshParentGrid(lookupOptions)
lookupOptions: An object with the following properties to specify the record:+
Property Name
Type
Required
Description
entityType
String
Yes
Entity type of the record.
id
String
Yes
ID of the record.
name
String
No
Name of the record.
showProgressIndicator
Displays a progress dialog with the specified message.
Xrm.Utility.showProgressIndicator(message)

Deprecated methods

The following table lists the new methods you should use instead of the deprecated methods in the Xrm.Utility namespace.
These methods were deprecated in Dynamics 365 (online), version 9.0.

Deprecated Method
New method to be used
alertDialog
Xrm.Navigation.openAlertDialog
confirmDialog
Xrm.Navigation.openConfirmDialog
getBarcodeValue
Xrm.Device.getBarcodeValue
getCurrentPosition
Xrm.Device.getCurrentPosition
openEntityForm
Xrm.Navigation.openForm
openQuickCreate
Xrm.Navigation.openForm
openWebResource
Xrm.Navigation.openWebResource

Deprecated(Removed) and Replacement JavaScript statements in Dynamics 365 Version 9.x

Summary : Dynamics 365 Version 9.x JavaScript Client API

Deprecated/Removed and Replacement JavaScript statements in Dynamics 365 Version 9.x JavaScript


Deprecated Client API
Replacement Client API
Xrm.Page
Forms: ExecutionContext.getFormContext 
Commands: Send it as the PrimaryControl parameter
Xrm.Page.context
Xrm.Utility.getGlobalContext
Xrm.Page.context.getQueryStringParameters
formContext.data.attributes
Xrm.Page.context.getTimeZoneOffsetMinutes
globalContext.userSettings.getTimeZoneOffsetMinutes
Xrm.Page.context.getUserId
globalContext.userSettings.userId
Xrm.Page.context.getUserLcid
globalContext.userSetings.languageId
Xrm.Page.context.getUserName
globalContext.userSettings.userName
Xrm.Page.context.getUserRoles
globalContext.userSettings.securityRoles
Xrm.Page.context.getIsAutoSaveEnabled
globalContext.organizationSettings.isAutoSaveEnabled
Xrm.Page.context.getOrgLcid
globalContext.organizationSettings.languageId
Xrm.Page.context.getOrgUniqueName
globalContext.organizationSettings.uniqueName
Xrm.Page.data.entity.getDataXml
No change in the method, but use "typename" instead of type for lookup attributes.
GridRow.getData
GridRow.data
GridRowData.getEntity
GridRowData.entity
Xrm.Mobile.offline
Xrm.WebApi.offline
parent.Xrm

addOnKeyPress
Use a custom control
removeOnKeyPress
Use a custom control
showAutoComplete
Use a custom control and corresponding UI
hideAutoComplete
Use a custom control and corresponding UI
Xrm.Utility.alertDialog
Xrm.Navigation.openAlertDialog
Xrm.Utility.confirmDialog
Xrm.Navigation.openConfirmDialog
Xrm.Utility.isActivityType
Xrm.Utility.getEntityMetadata
Xrm.Utility.openEntityForm
Xrm.Navigation.openForm
Xrm.Utility.openQuickCreate
Xrm.Navigation.openForm
Xrm.Utility.openWebResource
Xrm.Navigation.openWebResource

Dynamics 365 Version 9.x JavaScript Client API

Dynamics 365 Version 9.x JavaScript Client API
      
    The Client API object model for Dynamics 365 provides to us objects and methods that can used to apply custom business logic with JavaScript.
It’s important that we need to understand the Client API object model to effectively write and use your JavaScript code in D365.

Object Description
executionContext Execution context for an event in CRM forms and grids. 
formContext Provides a reference to a form or an item on the form against which the current code executes. To get the formContext object, use the executionContext.getFormContextmethod.
gridContext Provides a reference to a grid or a sub grid on a form against which the current code executes.
Xrm Provides a global object for performing operations that do not directly impact the data and UI in forms, grids, sub grids, controls, or attributes. For example, navigate forms, create and manage records using Web API.

Popular Posts