Create lookup on x++ AX 2012
Many time there is client's requirement of lookup to have specific fields from the table in Dynamics AX 2012.
try code below to create custom lookup.
Right click on the field and create lookup method and write the code as below.
public void lookup()
{
Query qr = new Query();
QueryBuildDataSource qbds;
QueryBuildDataSource qbdsJoin;
QueryBuildRange qbr,qbr1;
QueryRun qrun;
SysTableLookup sysTableLookup = sysTableLookup::newParameters( tableNum(ProjTable), this);
;
qbds= qr.addDataSource( tableNum(ProjTable));
qbds.joinMode(JoinMode::InnerJoin);
qbds.relations(true);
sysTableLookup.addLookupfield( fieldNum(ProjTable, ProjId));
sysTableLookup.addLookupfield( fieldNum(ProjTable, Name));
sysTableLookup.parmQuery(qr);
sysTableLookup.performFormLookup();
}
This helped you..!! Then comment below..:)
Many time there is client's requirement of lookup to have specific fields from the table in Dynamics AX 2012.
try code below to create custom lookup.
Right click on the field and create lookup method and write the code as below.
public void lookup()
{
Query qr = new Query();
QueryBuildDataSource qbds;
QueryBuildDataSource qbdsJoin;
QueryBuildRange qbr,qbr1;
QueryRun qrun;
SysTableLookup sysTableLookup = sysTableLookup::newParameters( tableNum(ProjTable), this);
;
qbds= qr.addDataSource( tableNum(ProjTable));
qbds.joinMode(JoinMode::InnerJoin);
qbds.relations(true);
sysTableLookup.addLookupfield( fieldNum(ProjTable, ProjId));
sysTableLookup.addLookupfield( fieldNum(ProjTable, Name));
sysTableLookup.parmQuery(qr);
sysTableLookup.performFormLookup();
}
This helped you..!! Then comment below..:)
No comments:
Post a Comment