Skip to main content

Posts

Showing posts with the label custom Lookup for Employee id in Ax 2012

Add custom Lookup for Employee id in Ax 2012

To Add customLookup for Employee id in Ax 2012 you can try below code sample in datasource filed of the form. You can add data method to lookup easily to get the name of the employee. Here HcmWorker is a master table of employee and personnel number and name is the field of Hcmworker table. SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(HcmWorker),_formControl); Query query = new Query(); QueryBuildDataSource queryBuildDataSource = query.addDataSource(tableNum(HcmWorker)); queryBuildDataSource.addRange(fieldnum(HcmWorker,Tester)).value(queryvalue(Noyes::Yes)); sysTableLookup.addLookupfield(fieldNum(HcmWorker,PersonnelNumber)); sysTableLookup.addLookupMethod(tableMethodStr(HcmWorker,Name)); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup();