Saturday 3 January 2015

Creation of Sys Lookup in Microsoft Dynamics AX


Steps to create a Sys Lookup :-

1. Create a Table with fields ( AccountName,Account,City).

2. Create a Form and use  DataSource as created Table.

3. Expand the Form DataSource and Expand Fields.

4. Override the Lookup() method  on the field where the lookup has to appear (Example Field -  Account).

5. Write the following code.

public void lookup(FormControl _formControl, str _filterStr)
{

    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(CustTable),_formControl);
    Query query = new  Query();
    QueryBuildDataSource qbds = query.addDataSource(tableNum(CustTable));
     super(_formControl, _filterStr);
     sysTableLookup.addLookupfield(fieldNum(CustTable,AccountNum));
    sysTableLookup.addLookupfield(fieldNum(CustTable,Currency));
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();

}

T

No comments:

Post a Comment