[X++] jumpRef lookupRecord
When there is the need to override the jumpRef method manually on a form, sometimes it seems to have a problem with the args.record
parameter of the args and doesn't jump to the right record.
Looks like the kernel doesn't fill the args.lookupRecord
automatically in some cases.
The fix is to fill the args.lookupRecord manually before calling the form or display menu item from code.
public void jumpRef()
{
DictTable recordDictTable = new DictTable(DataSource.RefTableId);
Common common;
ExecutePermission perm;
MenuFunction menuFunction;
Args args = new args();
#Properties
if (!recordDictTable || !recordDictTable.formRef())
{
return;
}
perm = new ExecutePermission();
perm.assert();
common = recordDictTable.makeRecord();
select firstOnly common
where common.RecId == DataSource.RefRecId;
args.record(common);
args.lookupRecord(common);
menuFunction = new MenuFunction(recordDictTable.formRef(), MenuItemType::Display);
if(menuFunction)
{
menuFunction.copyCallerQuery(CopyCallerQuery::Yes);
menuFunction.formViewOption(FormViewOption::Details);
menuFunction.run(args);
}
}