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

Announcements

No record found.

News and Announcements icon
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 558
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)
  • Suggested answer
    Waed Ayyad Profile Picture
    9,089 Super User 2026 Season 1 on at
    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

  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,801 Super User 2026 Season 1 on at
    Hi,
     
    I hope this can help you.
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Ken Manhattan Profile Picture
    558 on at
    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,801 Super User 2026 Season 1 on at
    Hi @ken,
     
    Yes you must use event handler to cancel the super call.
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Verified answer
    Waed Ayyad Profile Picture
    9,089 Super User 2026 Season 1 on at
    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

  • Ken Manhattan Profile Picture
    558 on at
    Thanks for the help and clarification.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 658

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 468 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 333 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans