look up

hi,

in my form i have to add new field .in that field when i say click on drop down then i should getthe look up of employee name and employee id .

any suggestions???

Which version you are using?

In AX 2009 you can use the emplId EDT, but in AX 2012 there were significant changes made to the employee entity.

take a look at the HCMWorkerLookup class, lookupWorker method. See the cross references for that method to understand the usage.

hi…

m working ax 2012 R2 , …customising on “InventQualityOrdertable” form where i am trying to get employee namefrom DirPartyTable & employee id from “HCM Worker” table .

is there another way to do this , mine s not workimg.

have you tried HCMWorkerLookup class?

i just checked lookupWorker method of HCMWorkerLookup class , i can see following code. but not sure about editing part [:(]

else if (stringControl)
{
formRun = FormAutoLookupFactory::buildLookupFromCustomForm(stringControl, workerLookupForm, AbsoluteFieldBinding::construct(fieldStr(HcmWorker, PersonnelNumber), tableStr(HcmWorker)), args);
stringControl.performFormLookup(formRun);
}

6165.lookup.png

public void lookup(FormControl _formControl, str _filterStr)
{
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildDataSource QbdsJoin;

SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(HcmWorker), _formControl);
;

qbds= query.addDataSource(tableNum(HcmWorker));

QbdsJoin= qbds.addDataSource(tableNum(DirPartyTable));

QbdsJoin.addLink(fieldNum(HcmWorker,PersonnelNumber),fieldNum(DirPartyTable,Name));

//QbdsJoin.addRelation(fieldNum(HcmWorker,PersonnelNumber),fieldNum(DirPartyTable,Name))

QbdsJoin.relations(true);

QbdsJoin.joinMode(JoinMode::InnerJoin);
//QbdsJoin.addRelation(fieldNum(HcmWorker,PersonnelNumber),fieldNum(DirPerson,Name));

sysTableLookup.parmQuery(query);

sysTableLookup.addLookupfield(fieldNum(HcmWorker, PersonnelNumber),true);

//sysTableLookup.addLookupMethod(tableStr(HcmWorker.Name()));

sysTableLookup.addLookupfield(fieldNum(DirPartyTable,Name));

sysTableLookup.performFormLookup();
}

finally i got the look up in my form …with the help of relation with HcmWorker.

but in lookup when i select any record , am getting a warning as “Field ‘Project ID’ must be filled in”.

where is the projectId?

finally i am done with this task , its working well.

thanks