Saturday, April 18, 2015


Dynamics AX field lookup method.

The below lookup method is overridden in the form datasource.

 public void lookup(FormControl _formControl, str _filterStr)
{
    SysTableLookup sysTableLookup;
    Query query;
    QueryBuildDataSource qbd;

    ;
    sysTableLookup = SysTableLookup::newParameters(tablenum([tableName]),_formcontrol);

    query = new Query();
    qbd = query.addDataSource(tablenum([tablename]));
    qbd.addRange(fieldnum([tablename],[fieldname])).value(SysQuery::value([value]));

    sysTableLookup.addLookupfield(fieldnum([fieldname]));
    sysTableLookup.addLookupfield(fieldnum([fieldname1]));
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();

}

Happy Programming!!

No comments: