AX / D365FO – How to access Form Controls in formDataSourceStr Extension

It’s easy, you must use this.formRun().design().controlName() syntax like shown below

[ExtensionOf(formDataSourceStr(SalesTableListPage,SalesTable))]

final class SalesTable_SalesTable_Extension
{
public int active()
{
int ret;

ret = next active();

SalesTable salesTable = this.cursor();

FormButtonGroupControl invoiceBtn = this.formrun().design().controlName(formControlStr(SalesTableListPage, buttonName)) as FormButtonGroupControl;

invoiceBtn.enabled(false);


return ret;
}
}

Leave a comment