Skip to main content

Notifications

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

Look up event handler on form control

(0) ShareShare
ReportReport
Posted on by 135

I have added new legal entity drop down field which shows legal entities based on relationship with company info(No lookup method behind). The field behind legal entity form control is CompanyInfo RecId field. I have another table which contain CompanyInfo RecId and some other field. I want the legal entity drop down will only shows those legal entities which are in second table. I can find second table based on job field selection. In other words I just want to add range(Drop-down only shows those legal entity which are in second table) on relationship based dropdown.

FormControl:

8081.pastedimage1685191519514v1.png

New added Field:

5076.pastedimage1685192032845v3.png

Relation based on which legal entity drop down is working:

2161.pastedimage1685192483884v5.png

Second table:

8156.pastedimage1685192296528v4.png

Drop-down:

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: look up event handler on form control

    You should use CompanyInfo table in SysReferenceGroup control.

    Thanks,

    Girish S.

  • itlabnarmi_ivoruk Profile Picture
    itlabnarmi_ivoruk 135 on at
    RE: look up event handler on form control

    Which table should provide to SysReferenceGroupControl as parameter ?

    [FormControlEventHandler(formControlStr(HcmPositionNewPosition, HcmPositionDetail_CompanyInfo), FormControlEventType::Lookup)]    public static void HcmPositionDetail_CompanyInfo_OnLookup(FormControl sender, FormControlEventArgs e)    

    {        

    SysReferenceTableLookup sysTableLookup =SysReferenceTableLookup::newParameters(tableNum(HcmPositionDetail/CompanyInfo), sender);

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: look up event handler on form control

    Hi,

    You need to write lookup event handler and use SysReferenceGroupControl class for the lookup.

    First you need to add CompanyInfo table to the query and then add the new table where you have created the field CompanyInfo. Using addLink method you can refer the relationship between two tables. Add the Job field as range to it which will be given in the position creation form.

    Thanks,

    Girish S.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,979 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,848 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans