Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

overridelookup method in form control

Posted on by

Hi Team,

I am new to AX and I got stuck while doing the below operation.

I have a Master Table where I have fields - EmployeeID, EmployeeName, Status(Active/No) and child table (LeaveApp)- LeaveID, EmployeeID (FK)

And I have a form for LeaveApp table in which EmployeeID lookup field should display only Active employees.

Could you please guide me how to write the lookup method on the control EmployeeID on the LeaveApp form?

Thanks.

  • Suresh M. Parmar Profile Picture
    Suresh M. Parmar 340 on at
    RE: overridelookup method in form control

    Hello Martin,

    You are right,

    In that case, only custom lookup is the option.

    For fixed field relation delete action, it will get ignored for inactive status.

    Thanks,

    Suresh Parmar

  • Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    RE: overridelookup method in form control

    I'm not so sure. If you use such a relation, select an active vendor employee and then somebody will make it inactive, the data in the table won't match the relation. Sich records will be ignored by queries using this relation, by delete actions and so on.

  • Suggested answer
    Suresh M. Parmar Profile Picture
    Suresh M. Parmar 340 on at
    RE: overridelookup method in form control

    Hi,

    You need to give the fixed field relation into the LeaveApp table, there is no need to write any custom lookup method.

    Follow SS for reference,

    Link docs.microsoft.com/.../conditional-table-relations

    pastedimage1634106420723v3.png

    Thanks,

    Suresh Parmar

    Please mark verified if get the solution.

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    RE: overridelookup method in form control

    Hi, I'm assuming that is just for training, because AX already contains a table for employees (HcmWorker).

    As I understand, you didn't use the surrogate key (RecId) for the link - you're using the string field EmployeeId. If so, then overriding lookup(), as you mentioned, is the right approach. Look into documentation to get an idea about how to do it: How to: Add a Lookup Form to a Control.

    By the way, please use Development / Customization / SDK category (not Other) for questions related to development. I've already changed it this time.

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.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans