Share via


Collections (client-side reference)

 

Applies To: Dynamics CRM 2013

You will find collections throughout the Xrm.Page object model. Collections are structures to provide access to data that represents an array, but without the ability to modify the data in the array.

The following are the collections available in the Xrm.Page object model:

  • Xrm.Page.data.entity.attributes: All the attributes on the page.

  • Xrm.Page.ui.controls: All the controls on the page.

  • Xrm.Page.ui.tabs: All the tabs on the page.

  • Xrm.Page.ui Tab.sections: All the sections in the tab.

  • Xrm.Page.ui Section.controls: All the controls in the section.

  • Xrm.Page.ui.navigation.items: All the items in the form navigation area.

  • Xrm.Page.ui.formSelector.items: All the forms available to the user.

  • Xrm.Page Attribute.controls: All the controls for the attribute.

Collection methods

  • forEach
    Apply an action in a delegate function to each object in the collection.

  • get
    Get one or more object from the collection depending on the arguments passed.

  • getLength
    Get the number of items in the collection.

forEach

Applies the action contained in a delegate function.

collection.forEach(delegate function(attribute, index))
  • Arguments
    Delegate function with parameters for attribute and index.

get

Get one or more object from the collection depending on the arguments passed.

collection.get([String][Number][delegate function(attribute, index)])

Note

The get method for the Xrm.Page.data.entity.attributes collection is available using the Xrm.Page.getAttribute shortcut method.

The get method for the Xrm.Page.ui.controls collection is available using the Xrm.Page.getControl shortcut method.

  • Arguments

    • None

      • Return Value All the objects in the collection.
        Type: Array
    • String

      • Return Value The object where the name matches the argument.
        Type: Object
    • Number

      • Return Value The object where the index matches the number
        Type: Object
    • delegate function(attribute, index)

      • Return Value Any objects that cause the delegate function to return true.
        Type: Array

getLength

Get the number of items in the collection.

collection.getLength()
  • Return Value
    Type: Number

See Also

Form scripting quick reference
Client-side programming reference
Xrm.Page.data.entity (client-side reference)
Xrm.Page.ui (client-side reference)
Xrm.Page.ui tab (client-side reference)
Xrm.Page.ui section (client-side reference)
Xrm.Page.data.entity attribute (client-side reference)
Write code for Microsoft Dynamics CRM 2013 forms
Use the Xrm.Page object model