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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Lookup method is not visible even after writing lookup method on Form>DS>Field

(0) ShareShare
ReportReport
Posted on by 23
Hi all,
 
I have written lookup method on form > ds > field. Even after my lookup is not visible. Please help with your solution.
 
[ExtensionOf(formDataFieldStr(CustTable, CustTable, PriorityName2))]final class CustTable_FormDS_Field_PriorityName2_Extension{    public void lookup(FormControl _formControl, str _filterStr)    {        //Specify the name of the table the lookup should show data from.        SysTableLookup          sysTableLookup = SysTableLookup::newParameters(tableNum(CustDeliveryPriority), _formControl);        //Create a new query        Query                   query = new Query();        QueryBuildDataSource    queryBuildDataSource;        QueryBuildRange         queryBuildRange;        next lookup(_formControl, _filterStr);         //Specify the name of the table the lookup should show data from.        queryBuildDataSource = query.addDataSource(tableNum(CustDeliveryPriority));        queryBuildRange = queryBuildDataSource.addRange(fieldNum(CustDeliveryPriority,PriorityName));        queryBuildRange.value(strFmt('(PriorityName != /%1/)', queryValue(/Ten days/)));        sysTableLookup.addLookupfield(fieldNum(CustDeliveryPriority, PriorityId));        sysTableLookup.addLookupfield(fieldNum(CustDeliveryPriority, PriorityName));        sysTableLookup.addLookupfield(fieldNum(CustDeliveryPriority, Description));         sysTableLookup.parmQuery(query);        sysTableLookup.performFormLookup();    }}
 
I have the same question (0)
  • Suggested answer
    Layan Jwei Profile Picture
    8,112 Super User 2025 Season 2 on at
    Hi Community User,

    You can try to do the lookup on form control, by creating an extension of the form and use Register override method
     
    [ExtensionOf(formStr(CustTable))]
    final class CustTableForm_Extension
    {
        public void init()
        {
            next init();
    
            YourFormControlName.registerOverrideMethod(methodStr(FormDataObject, lookup), formMethodStr(CustTable, overridePriorityName2Lookup));
        }
    
        public void overridePriorityName2Lookup(FormStringControl _formControl)
        {
      //add your lookup code here
    ​​​​​​​ //Specify the name of the table the lookup should show data from. SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(CustDeliveryPriority), _formControl); //Create a new query Query query = new Query(); QueryBuildDataSource queryBuildDataSource; QueryBuildRange queryBuildRange; //Specify the name of the table the lookup should show data from. queryBuildDataSource = query.addDataSource(tableNum(CustDeliveryPriority)); queryBuildRange = queryBuildDataSource.addRange(fieldNum(CustDeliveryPriority,PriorityName)); queryBuildRange.value(strFmt('(PriorityName != /%1/)', queryValue(/Ten days/))); sysTableLookup.addLookupfield(fieldNum(CustDeliveryPriority, PriorityId)); sysTableLookup.addLookupfield(fieldNum(CustDeliveryPriority, PriorityName)); sysTableLookup.addLookupfield(fieldNum(CustDeliveryPriority, Description)); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup(); } }

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Suggested answer
    Martin Dráb Profile Picture
    237,904 Most Valuable Professional on at
    This isn't a correct approach. Either use an event handler with cancelSuperCall(), or you'll need to utilize registerOverrideMethod(). You can find an example in How To Override An Existing Lookup Method: Chain Of Command, for instance.
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    To show your custom lookup at form level, the procedure is to write lookup code either at form ds field level or form control. If you are using COC, you need to write your lookup code and should override the standard lookup from init method of form datasource using register override method. If you are using event, then you should make use of onlookup event handler where you will cancel super call of standard lookup which makes sure our custom lookup will execute.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 544 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans