Tuesday, 5 April 2011

How to override lookup in Ax2009?

Write following method on form level

void SummaryProjectLookup(FormControl ctrl)
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(ProjTable),ctrl);
Query query = New Query();
QueryBuildDataSource queryBuildDataSource = query.addDataSource(tableNum(ProjTable));
QueryBuildRange queryBuildRange;
;

sysTableLookup.addLookupfield(fieldNum(ProjTable, ProjId));
sysTableLookup.addLookupfield(fieldNum(ProjTable, Name));
sysTableLookup.addLookupfield(fieldNum(ProjTable, Status));

queryBuildRange = queryBuildDataSource.addRange(fieldNum(ProjTable, Type));
queryBuildRange.value(queryValue(ProjType::DEL_Summary));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
*******************************************************************
public void lookup()
{
element.SummaryProjectLookup(this);
}

No comments:

Post a Comment