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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Add lookup method for Form extension, CoC or Event Handler ?

(1) ShareShare
ReportReport
Posted on by 552
Hi guys,
 
I have a Form extension, that in its datasource it was added custom table. The issue now is I need to create some lookup in one of its field.
 
Is it do able by create CoC on FormDataSource of it ? or must create EventHandler class for it ?
 
I currently create CoC, but could not get it the correct way, as I found the field is still without lookup.
 
Here is the detail:
1. Main form (and table) is SubBillScheduleTable 
2. In Form Extension, added my custom table TESTProductConfTable
3. Inside the table there is field named : ConfigurationID
4. So I wan to have this field having lookup to my ConfigurationTable (TESTConfigHeader)
 
I created CoC like this :
[ExtensionOf(formDataFieldStr(SubBillScheduleTable, TESTProductConfTable, ConfigurationId))
]
final class TESTSubBillScheduleTableFormDS_Extension
{

    void lookup(FormControl _formControl, str _filterStr)
    {
        Query query = new Query();
        QueryBuildDataSource queryBuildDataSource;
        QueryBuildRange queryBuildRange;
               
        SysTableLookup  sysTableLookup = SysTableLookup::newParameters(tableNum(TESTProductConfTable), _formControl);
        sysTableLookup.addLookupField(fieldNum(TESTConfigHeader, ConfigId));
        sysTableLookup.addLookupField(fieldNum(TESTConfigHeader, Name));
        sysTableLookup.addLookupField(fieldNum(TESTConfigHeader, Description));
        queryBuildDataSource = query.addDataSource(tableNum(TESTConfigHeader));
        sysTableLookup.parmQuery(query);
        sysTableLookup.performFormLookup();

        next lookup(_formControl, _filterStr);

        
    }
}
 
Please advise.
Thanks
Categories:
I have the same question (0)
  • Ken Manhattan Profile Picture
    552 on at
    Add lookup method for Form extension, CoC or Event Handler ?
    Thanks for the help and clarification.
  • Verified answer
    Waed Ayyad Profile Picture
    8,847 Super User 2025 Season 2 on at
    Add lookup method for Form extension, CoC or Event Handler ?
    Hi,
     
    Yes, you can't override it using COC.
     

    Thanks,

    Waed Ayyad

    If this helped, please mark it as "Verified" for others facing the same issue

  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,294 Super User 2025 Season 2 on at
    Add lookup method for Form extension, CoC or Event Handler ?
    Hi @ken,
     
    Yes you must use event handler to cancel the super call.
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Ken Manhattan Profile Picture
    552 on at
    Add lookup method for Form extension, CoC or Event Handler ?
    Hi both.
     
    Thanks. So in that case, based on the two reference, we cannot make it through CoC, can I say that ? it must be Event Handler class, isn't it ?
     
    Just want to make sure.
     
    Thanks
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,294 Super User 2025 Season 2 on at
    Add lookup method for Form extension, CoC or Event Handler ?
    Hi,
     
    I hope this can help you.
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Suggested answer
    Waed Ayyad Profile Picture
    8,847 Super User 2025 Season 2 on at
    Add lookup method for Form extension, CoC or Event Handler ?
    Hi,
     
    In order to add lookup to control via extension, you should follow the following link:
    https://ievgensaxblog.wordpress.com/2018/01/10/d365foe-how-to-override-form-data-source-field-lookup-method/
     

    Thanks,

    Waed Ayyad

    If this helped, please mark it as "Verified" for others facing the same issue

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

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

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 777 User Group Leader

#2
André Arnaud de Calavon Profile Picture

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

#3
Martin Dráb Profile Picture

Martin Dráb 602 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans