Migrating your Client API to Dynamics 365 CE (v9) – Part II – Attributes

Migrating your Client API to Dynamics 365 CE (v9) – Part II – Attributes

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

Xrm.Page.getAttribute

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

Dynamics CRM Client API Dynamics 365 v9 Client API
Xrm.Page.getAttribute(attr).getAttributeType formContext.getAttribute(attr).getAttributeType
Xrm.Page.getAttribute(attr).getFormat formContext.getAttribute(attr).getFormat
Xrm.Page.getAttribute(attr).getIsDirty formContext.getAttribute(attr).getIsDirty
Xrm.Page.getAttribute(attr).getName formContext.getAttribute(attr).getName
Xrm.Page.getAttribute(attr).getParent formContext.getAttribute(attr).getParent
Xrm.Page.getAttribute(attr).getRequiredLevel formContext.getAttribute(attr).getRequiredLevel
Xrm.Page.getAttribute(attr).getSubmitMode formContext.getAttribute(attr).getSubmitMode
Xrm.Page.getAttribute(attr).getUserPrivilege formContext.getAttribute(attr).getUserPrivilege
Xrm.Page.getAttribute(attr).getValue formContext.getAttribute(attr).getValue
Xrm.Page.getAttribute(attr).setRequiredLevel formContext.getAttribute(attr).setRequiredLevel
Xrm.Page.getAttribute(attr).setSubmitMode formContext.getAttribute(attr).setSubmitMode
Xrm.Page.getAttribute(attr).setValue formContext.getAttribute(attr).setValue
Xrm.Page.getAttribute(attr).addOnChange formContext.getAttribute(attr).addOnChange
Xrm.Page.getAttribute(attr).fireOnChange formContext.getAttribute(attr).fireOnChange
Xrm.Page.getAttribute(attr).removeOnChange formContext.getAttribute(attr).removeOnChange

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
Boolean, OptionSet Xrm.Page.getAttribute(attr).getInitialValue formContext.getAttribute(attr).getInitialValue
OptionSet Xrm.Page.getAttribute(attr).getOption formContext.getAttribute(attr).getOption
OptionSet Xrm.Page.getAttribute(attr).getOptions formContext.getAttribute(attr).getOptions
OptionSet Xrm.Page.getAttribute(attr).getSelectedOption formContext.getAttribute(attr).getSelectedOption
OptionSet, Number Xrm.Page.getAttribute(attr).getText formContext.getAttribute(attr).getText
Number Types Xrm.Page.getAttribute(attr).getMin formContext.getAttribute(attr).getMin
Number Types Xrm.Page.getAttribute(attr).getMax formContext.getAttribute(attr).getMax
Number Types Xrm.Page.getAttribute(attr).getPrecision formContext.getAttribute(attr).getPrecision
Number Types Xrm.Page.getAttribute(attr).getMaxLength formContext.getAttribute(attr).getMaxLength
Lookup Xrm.Page.getAttribute(attr).getIsPartyList formContext.getAttribute(attr).getIsPartyList

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