Migrating your Client API to Dynamics 365 CE (v9) - Part I
In this series, I will show the list of Dynamics CRM Api calls, and their new counterparts in Dynamics 365 Customer Engagement (v9). The first of this series will focus on the Xrm.Utility, Xrm.Page.data, Xrm.Page.ui and Xrm.Page.context. I will demonstrate the method calls in Dynamics CRM and how to get the same functionality using Dynamics 365 CE.
The following image shows the new Xrm object model in Dynamics 365 Customer Engagement (v9).
Xrm.Utility
The following table show the most commonly used function in the Dynamics CRM Xrm.Utility class, and the method calls in Dynamics 365 v9.
Dynamics CRM Client API | Dynamics 365 v9 Client API |
---|---|
Xrm.Utility.openEntityForm | Xrm.Navigation.openForm |
Xrm.Utility.openQuickCreate | Xrm.Navigation.openForm |
Xrm.Utility.openWebResource | Xrm.Navigation.openWebResource |
Xrm.Utility.alertDialog | Xrm.Navigation.openAlertDialog |
Xrm.Utility.confirmDialog | Xrm.Navigation.openConfirmDialog |
Click here to access the reference to the Xrm.Navigation properties and methods in Dynamics 365 CE.
Xrm.Page.data
The following table show the most commonly used function in the Dynamics CRM Xrm.Page.data class, and the method calls in Dynamics 365 v9.
Dynamics CRM Client API | Dynamics 365 v9 Client API |
---|---|
Xrm.Page.data.getIsValid | formContext.data.isValid |
Xrm.Page.data.save | forContext.data.save |
Xrm.Page.data.refresh | formContext.data.refresh |
Click here to access the reference to the formContext.data properties and methods in Dynamics 365 CE.
Xrm.Page.ui
The following table show the most commonly used function in the Dynamics CRM Xrm.Page.ui class, and the method calls in Dynamics 365 v9.
Dynamics CRM Client API | Dynamics 365 v9 Client API |
---|---|
Xrm.Page.ui.clearFormNotification | formContext.ui.clearFormNotification |
Xrm.Page.ui.close | forContext.ui.close |
Xrm.Page.ui.getViewPortHeight | formContext.ui.getViewPortHeight |
Xrm.Page.ui.getViewPortWidth | formContext.ui.getViewPortWidth |
Xrm.Page.ui.getFormType | formContext.ui.getFormType |
Xrm.Page.ui.setFormNotification | formContext.ui.setFormNotification |
Xrm.Page.ui.refreshRibbon | formContext.ui.refreshRibbon |
Xrm.Page.ui.navigation.items | formContext.ui.navigation class methods |
Xrm.Page.ui.formSelector.getCurrentItem & Xrm.Page.ui.formSelector.items | formContext.ui.formSelector class methods |
Click here to access the reference to the formContext.ui properties and methods in Dynamics 365 CE. For the formContext.ui.navigation reference, click here. For the formContext.ui.formSelector reference, click here.
Xrm.Page.context
The following table show the most commonly used function in the Dynamics CRM Xrm.Page.context class, and the method calls in Dynamics 365 v9. To use the following method your can set the global context by declaring it as a variable as such:
var context = Xrm.Utility.getGlobalContext();
var userId = context.userSettings.userId;
Dynamics CRM Client API | Dynamics 365 v9 Client API |
---|---|
Xrm.Page.context.client.getClient | context.client.getClient |
Xrm.Page.context.client.getClientState | context.client.getClientState |
Xrm.Page.context.getClientUrl | context.getClientUrl |
Xrm.Page.context.getOrgLcid | context.organizationSettings.languageId |
Xrm.Page.context.getOrgUniqueName | context.organizationSettings.uniqueName |
Xrm.Page.context.getUserId | context.userSettings.userId |
Xrm.Page.context.getUserLcid | context.userSettings.languageId |
Xrm.Page.context.getUserName | context.userSettings.userName |
Xrm.Page.context.getUserRoles | context.userSettings.securityRoles |
Xrm.Page.context.prependOrgName | context.userSettings.prependOrgName |
Click here to access the reference to the global context properties, methods and subclasses in Dynamics 365 CE.
Xrm.Page.data.entity
The following table show the most commonly used function in the Dynamics CRM Xrm.Page.data.entity class, and the method calls in Dynamics 365 v9.
Dynamics CRM Client API | Dynamics 365 v9 Client API |
---|---|
Xrm.Page.data.entity.getDataXml | formContext.data.entity.getDataXml |
Xrm.Page.data.entity.getEntityName | forContext.data.entity.getEntityName |
Xrm.Page.data.entity.getId | formContext.data.entity.getId |
Xrm.Page.data.entity.getIsDirty | formContext.data.entity.getIsDirty |
Xrm.Page.data.entity.getPrimaryAttributeName | formContext.data.entity.getPrimaryAttributeValue |
Xrm.Page.data.entity.save | formContext.data.entity.save |
Click here to access the reference to the forContext.data.entity properties and methods in Dynamics 365 CE.
In the next parts of these series I will cover the attributes and controls collections, properties and methods,
*This post is locked for comments