X++ code to filter a lookup field on form in ax2012

lookup for custaccount field, when open the custtable (custaccount field)  form

public void lookup()
{
Query query = new Query();
QueryBuildDataSource qbds_CustTable;
SysTableLookup sysTableLookup;
QueryBuildRange qbr;
//super();
sysTableLookup = SysTableLookup::newParameters(tablenum(CustTable), this);
qbds_CustTable = query.addDataSource(tableNum(CustTable));
sysTableLookup.addLookupfield(fieldnum(CustTable, AccountNum), true);
sysTableLookup.addLookupfield(fieldnum(CustTable, CustGroup),true);
qbr = qbds_CustTable.addRange(fieldNum(CustTable,CustGroup));
qbr.value(‘ENDUSER’);
sysTableLookup.parmUseLookupValue(false);
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}

Comments

  1. where should i write this code?

    ReplyDelete
  2. lookup method not calling.i have add the script in Budget register entry for Budget code.but my code is not calling.

    ReplyDelete

Post a Comment

Popular posts from this blog

Dynamics Ax 2012 Interview Questions:

Oops concept in AX