Langsung ke konten utama

To Add a Lookup Form to a StringEdit Control in AX 2012

In the AOT, expand Forms, expand the form, expand Designs, right-click Design, click New Control, and then click StringEdit. A StringEditcontrol is added to the form

Expand the control, right-click Methods, click Override method, and then click lookup. The lookup method opens in the code editor.

add this example to lookup methods



public void lookup()
{
    Query query = new Query();
    QueryBuildDataSource queryBuildDataSource;
    QueryBuildRange queryBuildRange; 

    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(custTable), this); 

    sysTableLookup.addLookupField(fieldNum(CustTable, AccountNum));
    sysTableLookup.addLookupField(fieldNum(CustTable, CustGroup)); 

    queryBuildDataSource = query.addDataSource(tableNum(CustTable));

    queryBuildRange = queryBuildDataSource.addRange(fieldNum(CustTable, CustGroup));
    queryBuildRange.value('40');

    sysTableLookup.parmQuery(query);

    sysTableLookup.performFormLookup();

    //super();
}

Komentar