control.getAttribute (Client API reference)

Returns the column that the control is bound to.

Controls that aren't bound to a column (subgrid, web resource, and IFRAME) don't have this method. An error will be thrown if you attempt to use this method on one of these controls.

Note

Unsure about entity vs. table? See Developers: Understand terminology in Microsoft Dataverse.

Control types supported

Standard, Lookup, OptionSet

Syntax

formContext.getControl(arg).getAttribute();

Return Value

Type: Object

Description: A column

Remarks

The constituent controls within a quick view control are included in the controls collection and these controls have the getAttribute method. However, the column is not part of the column collection for the table. While you can retrieve the value for that column using getValue and even change the value using setValue, changes you make will not be saved with the table.

The following code shows using the value the contact mobilephone column when displayed on an account form using a quick view control named contactQuickForm. This code hides the control when the value of the column is null.

var quickViewMobilePhoneControl = formContext.getControl("contactQuickForm_contactQuickForm_contact_mobilephone");
if (quickViewMobilePhoneControl.getAttribute().getValue() == null) {
    quickViewMobilePhoneControl.setVisible(false);
}

Quick view control

Columns