javascriptdynamics-crmmsdndynamics-crm-2016xrm

Xrm.Page object hierarchy


I am going to understand the Xrm.Page object hierarchy , that has 3 objects in it.

1. Context

2. Data

3. UI

Yes! Good. But in the given diagram documentation , Some child objects are blue while some are white. Is it specific reason for that? Why they are of different color? Are these Objects or Collections or something else? Any idea?

enter image description here


Solution

  • White denotes objects. Blue denotes collections.

    Let’s take 2 examples.

    To get id property of entity record, have to use getId() method of entity object.

    Xrm.Page.data.entity.getId()
    

    Xrm.Page.data.entity provides methods to retrieve information specific to the record displayed on the page, the save method, and a collection of all the attributes included in the form.

    To get all the child attributes of entity record, entity object gives attributes collection. Pass the name & get the particular attribute properties.

    Xrm.Page.getAttribute(arg).getAttributeType()
    

    The Xrm.Page.data.entity.attributes collection provides access to each entity attribute that is available on the form.

    Xrm.Page.getAttribute is the shortcut for accessing Xrm.Page.data.entity.attributes collections.