As we all know that we have extensively used SysTableLookup in older versions of AX to get the custom lookups. This class is still available in AX 2012.
But, in AX 2012 a new class SysFieldGroupLookup has been introduced which will help to get the lookup from the field groups of the table. This is a very useful feature as most of the fields to be added to the lookup fields can be reduced and can be pulled from the Table >> field groups directly.
Let me explain with an example:
public void
lookup()
{
Query query;
QueryBuildDataSource qbds;
Querybuildrange qbr;
SysTableLookup sysTableLookup;
SysFieldGroupLookup
sysFieldGroupLookup;
super();
query = new Query();
qbds =query.addDataSource(tableNum(SalesLine));
qbr =
qbds.addRange(fieldNum(SalesLine,SalesId));
qbr.value(SalesId.valueStr());
sysFieldGroupLookup
=sysFieldGroupLookup::newParameters(tableNum(SalesLine),this);
sysFieldGroupLookup.addLookupfield(fieldNum(SalesLine,ItemId));
sysFieldGroupLookup.parmFieldGroupNameForLookup(literalStr(Autoreport));
sysFieldGroupLookup.parmQuery(query);
sysFieldGroupLookup.performFormLookup();
}
No comments:
Post a Comment