D365/ Ax2012: X++ code for custom lookup to show customer account and Name
public void lookup()
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource, qbds;
QueryBuildRange queryBuildRange;
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(custTable), this);
sysTableLookup.addLookupField(fieldNum(CustTable, AccountNum));
sysTableLookup.addLookupField(fieldNum(CustTable, CustGroup));
sysTableLookup.addLookupField(fieldNum(CustTable, Party), false);
queryBuildDataSource = query.addDataSource(tableNum(CustTable));
qbds = queryBuildDataSource.addDataSource(tableNum(DirPartyTable));
qbds.joinMode(JoinMode::InnerJoin);
qbds.addLink(fieldNum(CustTable, Party), fieldNum(DirPartyTable, RecId));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource, qbds;
QueryBuildRange queryBuildRange;
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(custTable), this);
sysTableLookup.addLookupField(fieldNum(CustTable, AccountNum));
sysTableLookup.addLookupField(fieldNum(CustTable, CustGroup));
sysTableLookup.addLookupField(fieldNum(CustTable, Party), false);
queryBuildDataSource = query.addDataSource(tableNum(CustTable));
qbds = queryBuildDataSource.addDataSource(tableNum(DirPartyTable));
qbds.joinMode(JoinMode::InnerJoin);
qbds.addLink(fieldNum(CustTable, Party), fieldNum(DirPartyTable, RecId));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
Comments
Post a Comment