get

You can use the Xrm.Page.getControl() shortcut to access this method directly.

Arguments

None

Return Value All the controls.

Type: Array

Example:The SDK.UISamples.getFirstControlAttribute function alerts the user with the attribute label of the first control on the form.

String

Return Value The control where the name matches the argument.

Type: Object

Note

Any additional controls for any attribute will be named <attribute name>+n. For example, if there are two controls for an attribute named “new_regionoptionset” the first control will be named “new_regionoptionset” and the second will be named “new_regionoptionset1”.

Number

Return Value The control where the index matches the number

Type: Object

Example:The SDK.UISamples.getFirstControl function gets the first control on the form, and then using the attribute name from the control, gets the control by name, and compares the two.

SDK.UISamples.getFirstControl = function () {
var firstControlByPosition = Xrm.Page.ui.controls.get(0);
var firstControlByName = Xrm.Page.ui.controls.get(firstControlByPosition.getName());
if (firstControlByName == firstControlByPosition) {
alert("The first control on the form is '" + firstControlByPosition.getLabel() + "'.");
}
else {
alert("An error has occurred:\n\nUnable to determine the label of the first control on the form.");
}
};

delegate function(attribute, index)

Return Value Any controls that cause the delegate function to return true.

Type: Array

Example:The SDK.UISamples.getAllLookupAttributes function alerts the user with the attribute name for every lookup control on the form.