Κοινή χρήση μέσω


Collections (client-side reference)

 

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

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 list shows the collections that are 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.quickForms: All the quick view controls on the page using the new form rendering engine.

  • 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.

  • Xrm.Page.data.process.getActivePath: The stages in the current active path based on branching rules.

  • The process getStages method for a process returned by Xrm.Page.data.process.getActiveProcess.

  • The stage getSteps method for stages returned by Xrm.Page.data.process.getActiveStage, Xrm.Page.data.process.getActivePath and Xrm.Page.data.process.getActiveProcess.

Note

The objects returned in the Xrm.Page.data.process namespace don’t contain names, so using the string parameter for the get method returns no objects.

With Microsoft Dynamics CRM Online 2015 Update 1, the getRows and getSelectedRows return collections of GridRow. More information: Grid (read-only) objects and methods (client-side reference)

Collection methods

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

  • get
    Get one or more objects 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 objects 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

        Remarks: The objects returned in the Xrm.Page.data.process namespace don’t contain names, so using the string parameter for this method returns no objects.

    • 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 365 forms
Use the Xrm.Page object model

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright