Migrating your Client API to Dynamics 365 CE (v9) – Part III – Controls

Migrating your Client API to Dynamics 365 CE (v9) – Part III – Controls

In this third post of the series, we will review the changes between the properties and methods of the control based on the getControls Collection or the Xrm.Page.getControl method. The tables below will show the base methods of the control, as well as specific method for specific control types.

Xrm.Page.getControl

The following table show the most commonly used properties and methods in the Dynamics CRM Xrm.Page.getControl and Xrm.Page.data.entity.control classes, and the method calls in Dynamics 365 v9.

Dynamics CRM Client API Dynamics 365 v9 Client API
Xrm.Page.getControl(attr).getControlType formContext.getControl(attr).getControlType
Xrm.Page.getControl(attr).getAttributes formContext.getControl(attr).getAttribute
Xrm.Page.getControl(attr).getDisabled formContext.getControl(attr).getDisabled
Xrm.Page.getControl(attr).getLabel formContext.getControl(attr).getLabel
Xrm.Page.getControl(attr).getName formContext.getControl(attr).getName
Xrm.Page.getControl(attr).getParent formContext.getControl(attr).getParent
Xrm.Page.getControl(attr).setDisabled formContext.getControl(attr).setDisabled
Xrm.Page.getControl(attr).setFocus formContext.getControl(attr).setFocus
Xrm.Page.getControl(attr).setLabel formContext.getControl(attr).setLabel
Xrm.Page.getControl(attr).setVisible formContext.getControl(attr).setVisible
Xrm.Page.getControl(attr).setNotification formContext.getControl(attr).setNotification
Xrm.Page.getControl(attr).clearNotification formContext.getControl(attr).clearNotification

The next table will show additional properties and methods of the Xrm.Page.getAttribute and Xrm.Page.data.entity.attribute classes, that are specific to particular data types.

Attribute Type Dynamics CRM Client API Dynamics 365 v9 Client API
DateTime Xrm.Page.getControl(attr).getShowTime formContext.getControl(attr).getShowTime
DateTime Xrm.Page.getControl(attr).setShowTime formContext.getControl(attr).setShowTime
Lookup Xrm.Page.getControl(attr).addCustomFilter formContext.getControl(attr).addCustomFilter
Lookup Xrm.Page.getControl(attr).addCustomView formContext.getControl(attr).addCustomView
Lookup Xrm.Page.getControl(attr).addPreSearch formContext.getControl(attr).addPreSearch
Lookup Xrm.Page.getControl(attr).getDefaultView formContext.getControl(attr).getDefaultView
Lookup Xrm.Page.getControl(attr).removePreSearch formContext.getControl(attr).removePreSearch
Lookup Xrm.Page.getControl(attr).setDefaultView formContext.getControl(attr).setDefaultView
OptionSet Xrm.Page.getControl(attr).addOption formContext.getControl(attr).addOption
OptionSet Xrm.Page.getControl(attr).clearOptions formContext.getControl(attr).clearOptions
OptionSet Xrm.Page.getControl(attr).removeOption formContext.getControl(attr).removeOption
Web Resouce/IFrame Xrm.Page.getControl(attr).getData formContext.getControl(attr).getData
Web Resouce/IFrame Xrm.Page.getControl(attr).getInitialUrl formContext.getControl(attr).getInitialUrl
Web Resouce/IFrame Xrm.Page.getControl(attr).getObject formContext.getControl(attr).getObject
Web Resouce/IFrame Xrm.Page.getControl(attr).getSrc formContext.getControl(attr).getSrc
Web Resouce/IFrame Xrm.Page.getControl(attr).setData formContext.getControl(attr).setData
Web Resouce/IFrame Xrm.Page.getControl(attr).setSrc formContext.getControl(attr).setSrc

Click here to access the reference to the formContext.getControl properties and methods in Dynamics 365 CE.