General X++ Development

How do I enable or disable a form control in X++?

Asked by Sunny Vasty· Aug 13, 2026· 1 answers

How do I enable or disable a form control in X++?

SSunny Vasty75 reputation · answered Aug 13, 2026

For an unbound control:

X++
YourControl.enabled(canEdit);

For a field that is bound to a datasource, I usually control the datasource field instead:

X++
MyTable_ds.object(fieldNum(MyTable, MyField)).allowEdit(canEdit);

That way you are controlling the field itself instead of only one visual control that happens to display it.