Deprecated client APIs

This article is based on the Microsoft Power Platform doc page. See the original article on the Microsoft documentation site: Important changes coming: Some client APIs are deprecated

The following client APIs are deprecated to reorganize the Xrm client API object model to better align with the need of using the same client scripts without having to change them based on the context or the client (web client or the new Unified Interface) where they run. You should plan to use the new client APIs mentioned in the Replacement Client API column instead of the deprecated ones. The deprecated client APIs will continue to be available and supported until they are officially removed from a future major release. 

Deprecated client APIReplacement client APIComments
Xrm.PageForms: ExecutionContext.getFormContext
Commands: Send it as the PrimaryControl parameter
Use of the Xrm.Page object as a static access to the primary form context is still supported to maintain backward compatibility with the existing scripts. Based on the feedback, we understand that the usage of Xrm.Page is high, and it won't be removed as soon as some other client API methods listed in this section. We encourage you to use the new way of getting form content where possible. More information: Client API form context
Although Xrm.Page is deprecated, parent.Xrm.Page will continue to work in case of HTML web resources embedded in forms as this is the only way to access the form context from the HTML web resource.
Xrm.Page.contextXrm.Utility.getGlobalContextAllows access to the global context without going through the form context.
Xrm.Page.context.getQueryStringParametersformContext.data.attributesThe formContext.data.attributes API will make retrieval of non-entity bound data consistent across entity forms, metadata-driven dialogs, and task-based flows. The data will be a combination of custom values sent using the query string and what was specified in the parameters in the openForm method.
Xrm.Page.context.getTimeZoneOffsetMinutesglobalContext.userSettings.getTimeZoneOffsetMinutesMoved to globalContext.userSettings
Xrm.Page.context.getUserIdglobalContext.userSettings.userIdMoved to globalContext.userSettings
Xrm.Page.context.getUserLcidglobalContext.userSettings.languageIdMoved to globalContext.userSettings
Xrm.Page.context.getUserNameglobalContext.userSettings.userNameMoved to globalContext.userSettings
Xrm.Page.context.getUserRolesglobalContext.userSettings.securityRolesMoved to globalContext.userSettings
Xrm.Page.context.getIsAutoSaveEnabledglobalContext.organizationSettings.isAutoSaveEnabledMoved to globalContext.organizationSettings
Xrm.Page.context.getOrgLcidglobalContext.organizationSettings.languageIdMoved to globalContext.organizationSettings
Xrm.Page.context.getOrgUniqueNameglobalContext.organizationSettings.uniqueNameMoved to globalContext.organizationSettings
Xrm.Page.data.entity.getDataXmlNo change in the method, but use "typename" instead of type for lookup attributes.
GridRow.getDataGridRow.dataGridRow is essentially a form context. This change unifies the interface of GridRow with formContext.
GridRowData.getEntityGridRowData.entityGridRowData is form data. This change unifies the interface of GridRowData with formContextData.
Xrm.Mobile.offlineXrm.WebApi.offlineMoved the offline-related methods under Xrm.WebApi.offline
parent.XrmUse one of the following:

a) Use a custom control created using Power Apps component framework instead of HTML web resources.

b) On forms, use the getContentWindow method of the web resource control.

c) If the getContentWindow method doesn't work, you can use parent.Xrm to get to the Xrm object inside an HTML web resource. If the HTML web resource is opened in a new window, then you should use opener.Xrm instead.
Earlier: An HTML web resource may interact with the Xrm.Page or Xrm.Utility objects within the form by using parent.Xrm.Page or parent.Xrm.Utility.

Now: parent.Xrm.* will work if the HTML web resource is loaded in a form container. It won't work for HTML web resources that are stand alone, or referenced from the site map or any other places.

NOTE: parent.Xrm will be removed after the removal of the ClientGlobalContext.js.aspx page; dates yet to be announced.
addOnKeyPressUse a custom control created using Power Apps component framework
fireOnKeyPressUse a custom control created using Power Apps component framework
removeOnKeyPressUse a custom control created using Power Apps component framework
showAutoCompleteUse a custom control created using Power Apps component framework
hideAutoCompleteUse a custom control created using Power Apps component framework
Xrm.Utility.alertDialogXrm.Navigation.openAlertDialogThe new signature is consistent with other APIs (openForm) and takes a new set of parameters for flexibility.
Xrm.Utility.confirmDialogXrm.Navigation.openConfirmDialogThe new signature is consistent with other APIs (openForm) and takes a new set of parameters for flexibility.
Xrm.Utility.getBarcodeValueXrm.Device.getBarcodeValueMoving device-related actions to Xrm.Device
Xrm.Utility.getCurrentPositionXrm.Device.getCurrentPositionMoving device-related actions to Xrm.Device
Xrm.Utility.isActivityTypeXrm.Utility.getEntityMetadataThe isActivityType method is synchronous so it was suitable for ribbon rules. However, the replacement method, getEntityMetadata, is asynchronous, and is not suitable for ribbon rules.
Xrm.Utility.openEntityFormXrm.Navigation.openFormMoving navigation actions to Xrm.Navigation
Xrm.Utility.openQuickCreateXrm.Navigation.openFormMoving navigation actions to Xrm.Navigation
Xrm.Utility.openWebResourceXrm.Navigation.openWebResourceMoving navigation actions to Xrm.Navigation
Note: This API returns VOID in Unified Interface.
globalContext.organizationSettings.baseCurrencyIdglobalContext.organizationSettings.baseCurrencyThe replacement method lets you access the display name along with the ID of transaction currency.
globalContext.userSettings.securityRolesglobalContext.userSettings.RolesThe replacement method lets you access the display name along with the ID of the security roles.
globalContext.userSettings.transactionCurrencyIdglobalContext.userSettings.transactionCurrencyThe replacement method lets you access the display name along with the ID of transaction currency.
getData and setData for Silverlight web resourcesNoneSilverlight is no longer supported. These methods won't be available after October 2020.
formContext.data.entity.saveformContext.data.save
ClientGlobalContext.js.aspxNoneThe ClientGlobalContext.js.aspx page is deprecated and scheduled to be unavailable after October 1, 2021. Alternative methods to access global context information will be available before April 1, 2021.

For information about the new client APIs, see Apply business logic using client scripting in model-driven apps using JavaScript.




Last modified on Feb 24, 2021