Table Name Lookup in Ax 2012

Description: Here is the code to create Table name lookup in ax 2012.


public void lookup()
{
    SysTableLookup              sysTableLookup = SysTableLookup::newParameters(tablenum(UtilidElements), this);
    Query                       query = new Query();
    QueryBuildDataSource        queryBuildDataSource;
    QueryBuildRange             nameQBR, typeQBR;
    ;
    sysTableLookup.addLookupfield(fieldnum(UtilidElements, Name));
    sysTableLookup.addLookupfield(fieldnum(UtilidElements, Id)); 

    queryBuildDataSource = query.addDataSource(tablenum(UtilidElements)); 

    nameQBR = queryBuildDataSource.addRange(fieldnum(UtilidElements, name)); 

    typeQBR = queryBuildDataSource.addRange(fieldnum(UtilidElements, recordType));
    typeQBR.value(SysQuery::value(UtilElementType::Table)); 

    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

Related Posts

Previous
Next Post »

Thanks for comments.....