First off, the code displayed below, extracted from where it is sitting in our AX, WORKS. Both the class creating the dialog and the class containing the lookup are set to run on "Called From". The class where the dialog method sits is an abstract class. Could that cause this error? The parent class also does not extend RunBase. Not sure if that makes a difference or not.
I am receiving this error, "The method DialogControl.control cannot be called from the server; use methods on the DialogField class instead", when attempting to add a lookup override to a dialog field.
Any help or workarounds would be greatly appreciated.
protected boolean dialog()
{
Dialog dialog = new Dialog("My Dialog", this);
DialogField myField;
boolean ok;
myField = dialog.addFieldValue(extendedTypeStr(MyStringType),
"DefaultValue", "FieldCaption", "FieldHelp");
myField.registerOverrideMethod(
methodStr(FormStringControl, lookup),
methodStr(MyClassName, MyLookupMethod),
new MyClassName());
ok = dialog.run();
}
private void MyLookupMethod(FormStringControl _control)
{
SysTableLookup sysTableLookup;
QueryBuildDataSource queryBuildDataSource;
Query query = new Query();
queryBuildDataSource = query.addDataSource(tablenum(CustTable));
sysTableLookup = SysTableLookup::newParameters(tablenum(CustTable), _control);
sysTableLookup.addLookupfield(fieldnum(CustTable, AccountNum), true);
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}