Announcements
No record found.
Hi, I am customizing the Asset form in D365 F&O. Requirement: Add a Responsible User lookup field where:
If UserType = Employee, the lookup should display records from HcmWorker.
UserType = Employee
If UserType = NonEmployee, the lookup should display records from a custom table CIMDTNonEmployee (Name, CompanyName, NonEmployeeType).
UserType = NonEmployee
I created a new field CIMDTResponsibleUser on EntAssetObjectTable and added it to the form. I tried writing an OnLookup event handler but I’m not sure how to switch between Worker and NonEmployee tables properly.
CIMDTResponsibleUser
EntAssetObjectTable
Code Tried:
[FormControlEventHandler(formControlStr(EntAssetObjectTable, CIMDTResponsibleUser), FormControlEventType::Lookup)] public static void CIMDTResponsibleUser_OnLookup(FormControl sender, FormControlEventArgs e) { super(); }
Question: How can I implement a lookup that dynamically switches between HcmWorker and CIMDTNonEmployee based on the UserType enum?
UserType
{ Query query = new Query(); QueryBuildDataSource qbds, qbds1; FormControlCancelableSuperEventArgs cancelableArgs = e as FormControlCancelableSuperEventArgs; If(table.field = type::employee) { SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(HcmWorker), sender); qbds = query.addDataSource(tableNum(HcmWorker)); sysTableLookup.parmQuery(query); sysTableLookup.addLookupfield(fieldNum(HcmWorker, field1)); sysTableLookup.addLookupfield(fieldNum(HcmWorker, field2)); sysTableLookup.performFormLookup(); cancelableArgs.CancelSuperCall(); } Else If(table.field = type::NonEmployee) { SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(CIMDTNonEmployee ), sender); qbds1 = query.addDataSource(tableNum(CIMDTNonEmployee )); sysTableLookup.parmQuery(query); sysTableLookup.addLookupfield(fieldNum(CIMDTNonEmployee , field1)); sysTableLookup.addLookupfield(fieldNum(CIMDTNonEmployee , field2)); sysTableLookup.performFormLookup(); cancelableArgs.CancelSuperCall(); } }
I have created a custom string field called CIMDTResponsibleUser in my table/form. I want this field to open the HcmWorker form as a lookup, so the user can select a worker. How can I achieve this in D365 Finance & Operations?
Thanks,
Waed Ayyad
If this helped, please mark it as "Verified" for others facing the same issue
I have a standard lookup on my AllAsset form for the ResponsibleUser field. Currently, it works for Employee and Contractor types. I want to extend it as follows:
ResponsibleUser
Keep the existing ranges for Employee and Contractor as they are.
Add a new type called Non-Employee. When this is selected, the lookup should show data from my custom table (CIMDTNonEmployeeTable) instead of the standard Employee table.
CIMDTNonEmployeeTable
The lookup should behave exactly like the standard one for Employee and Contractor.
I tried overriding the OnLookup method, but I’m not sure how to conditionally switch the datasource based on the selected type and keep the standard behavior intact for other types.
OnLookup
Question: How can I implement a conditional lookup in D365 X++ that:
Uses the standard table for Employee and Contractor
Uses my custom table for Non-Employee
Keeps standard lookup behavior otherwise
Hi all,
I am working on the AllAsset form in D365 F&O. I have a new requirement:
There is an enum field ResponsibleUserType with values Employee and Non-Employee
There is a field ResponsibleUser. The lookup on this field should behave based on ResponsibleUserType:
If Employee is selected → show the standard HcmWorker lookup form (HcmWorkerLookup).
HcmWorkerLookup
If Non-Employee is selected → show a custom lookup from my table CIMDTNonEmployeeTable.
I want to implement this without breaking the existing HcmWorker relationships, and ensure the lookup behaves correctly for both Employee and Non-Employee.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Giorgio Bonacorsi 658
André Arnaud de Cal... 468 Super User 2026 Season 1
Syed Haris Shah 333 Super User 2026 Season 1