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, ...
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)
  • Suggested answer
    Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 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,390 Super User 2025 Season 2 on at
    Hi,
     
    I hope this can help you.
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Ken Manhattan Profile Picture
    552 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,390 Super User 2025 Season 2 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,039 Super User 2025 Season 2 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
    552 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

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 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans