How to override lookupReference for reference group in Dynamics Ax 2012 using X++

 

public Common lookupReference(FormReferenceControl _formReferenceControl)
{
    Query                         query     = new Query();
    QueryBuildDataSource          qbds;
    QueryBuildRange               range;
    SysReferenceTableLookup       sysTableLookup = SysReferenceTableLookup::newParameters(tableNum(HcmWorker), _formReferenceControl, true);
    
    sysTableLookup.addLookupField(fieldNum(HcmWorker, PersonnelNumber));
    sysTableLookup.addLookupField(fieldNum(HcmWorker, Person));
    
    sysTableLookup.parmQuery(query);       
    qbds    = query.addDataSource(tableNum(HcmWorker));
    range   = SysQuery::findOrCreateRange(qbds,fieldNum(HcmWorker,PersonnelNumber));
    range.value(SysQuery::valueLikeAfter('10'));
    return sysTableLookup.performFormLookup();
}

Comments

Popular posts from this blog

How to loop through enum in dynamics ax 2012 using x++

How to read from csv file in Dynamics AX 2012 Through X++

How to Create Transfer Journal in Dynamics AX 2012 Through X++