Tuesday, 13 July 2021

D 365 FO Form field level query lookup

Go to the field for which you want to add the query-based lookup, select the field under field, select the lookup method, paste the below code, and change wherever required.


For me, I'm Adding the Customer details lookup for the field

public void lookup()

        {

            Query                   query = new Query();

            QueryBuildDataSource    queryBuildDataSource;

            SysTableLookup          sysTableLookup;

            super();


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

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


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

            sysTableLookup.addLookupField(fieldNum(CustTable, Party));

            sysTableLookup.addLookupField(fieldNum(CustTable, RecId));


            sysTableLookup.parmQuery(query);

            sysTableLookup.performFormLookup();

        }



Thank you

Keep Daxing :)

No comments: