Skip to main content

Notifications

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

How to add custom lookup method to the datasource field in form?

(0) ShareShare
ReportReport
Posted on by 737
Hi,
Can anyone suggest how to add a custom lookup to datasource field in form?
It is known that I could do it through event handler on the form control, but users often personalize the form view for themselves, and so event handler will not work here.
 
 
Thanks.
 
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    How to add custom lookup method to the datasource field in form?
    You can use event handler which is simply a single method. But with COC, you need to override 2 methods I remember. Using event handler, you can event stop standard lookup execution too.
  • Shooowtek Profile Picture
    Shooowtek 737 on at
    How to add custom lookup method to the datasource field in form?
    Does anyone have a suggestion?
  • Shooowtek Profile Picture
    Shooowtek 737 on at
    How to add custom lookup method to the datasource field in form?
    Hello. Thank you for your reply.
     
    The event handler is for a specific control in the forms. In case the user personalizes his grid, this will not work because the form control contains SysGen....
     
    That's why I'm looking for another solution.
     
    Thanks.
  • Mohit Rampal Profile Picture
    Mohit Rampal 12,552 Super User 2024 Season 1 on at
    How to add custom lookup method to the datasource field in form?
    Hi, May I know what's the issue if user personalizes the form?
  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    How to add custom lookup method to the datasource field in form?
    Hi Shooowtek,
     
    It's not recommended approach to write COC for lookup method.
    If you write COC for lookup method - I guess the lookup will call two times - One from the next keyword and other from the code you have written lookup for - Mostly it will throw error. Only way will be through event handler only.
     
    Thanks,
    Girish S.
  • Shooowtek Profile Picture
    Shooowtek 737 on at
    How to add custom lookup method to the datasource field in form?
    I created an extension, but unfortunately it does not work. Can anyone help?
     
    [ExtensionOf(formDataFieldStr(SalesTable, SalesLine, MyField))]
    final class SalesTable_SalesLine_MyField_Extension
    {
        public void lookup(FormControl _formControl, str _filterStr)
        {
            
            next lookup(_formControl, _filterStr);
            
            info("Custom lookup OK");
        }
    }
     

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,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,817 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans