How to add custom lookup (Multi tables)in Dynamics AX 2012 Through X++
How to add custom lookup (Multi tables)in Dynamics AX 2012 Through X++
public static void lookupInvoice(FormControl _formControl, str _filterStr)
{
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildDataSource qbds_HcmWorker;
QueryBuildDataSource qbds_DirPerson;
SysMultiTableLookup SysMultiTableLookup;
{
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildDataSource qbds_HcmWorker;
QueryBuildDataSource qbds_DirPerson;
SysMultiTableLookup SysMultiTableLookup;
qbds = query.addDataSource(tableNum(CustInvoiceJour));
qbds_HcmWorker = qbds.addDataSource(tableNum(HcmWorker));
qbds_HcmWorker.joinMode(JoinMode::InnerJoin);
qbds_HcmWorker.addLink(fieldNum(CustInvoiceJour, WorkerSalesTaker), fieldNum(HcmWorker, RecId));
qbds_DirPerson = qbds_HcmWorker.addDataSource(tableNum(DirPerson));
qbds_DirPerson.joinMode(JoinMode::InnerJoin);
qbds_DirPerson.addLink(fieldNum(HcmWorker, Person), fieldNum(DirPerson, RecId));
SysMultiTableLookup = SysMultiTableLookup::newParameters(_formControl, query);
SysMultiTableLookup.addLookupField(fieldNum(CustInvoiceJour, InvoiceId));
SysMultiTableLookup.addLookupField(fieldNum(CustInvoiceJour, InvoiceAccount));
SysMultiTableLookup.addLookupField(fieldNum(CustInvoiceJour, SalesId));
SysMultiTableLookup.addLookupField(fieldNum(CustInvoiceJour, InvoiceDate));
SysMultiTableLookup.addLookupField(fieldNum(CustInvoiceJour, OrderAccount));
SysMultiTableLookup.addLookupField(fieldNum(DirPerson,Name),3,false,"Second salesman");
SysMultiTableLookup.performFormLookup();
}
Comments
Post a Comment