web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
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 843
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.
 
I have the same question (0)
  • Shooowtek Profile Picture
    843 on at
    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");
        }
    }
     
  • Suggested answer
    GirishS Profile Picture
    27,829 Moderator on at
    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.
  • Mohit Rampal Profile Picture
    12,565 Moderator on at
    Hi, May I know what's the issue if user personalizes the form?
  • Shooowtek Profile Picture
    843 on at
    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.
  • Shooowtek Profile Picture
    843 on at
    Does anyone have a suggestion?
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 622 Super User 2025 Season 2

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 438 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 354 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans