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, ...
Suggested Answer

Call form extension method on datafield event handler

(1) ShareShare
ReportReport
Posted on by 8
Hello everybody, 
 
I have added FieldA on ProjTable table and eventually in the form. 
I need to run some logic when the field is modified on the form.
So, I have created MethodA on ProjTable_Form_Extension class and I am trying to call it from the data field event handler.
Below the code:
 
  [FormDataFieldEventHandler(formDataFieldStr(ProjTable, ProjTable, FieldA), FormDataFieldEventType::Modified)]
    public static void FieldA_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
    {
        FormDataSource  projTable_ds   = sender.datasource() as FormDataSource;
        FormRun              formRun         = sender.datasource().formRun() as FormRun;
        ProjTable             projTable         = projTable_ds.cursor();
       
            formRun.methodA();
        }
    }
 
[ExtensionOf(formStr(ProjTable))]
final class ProjTable_Form_Extension
{
    public void methodA()
    {
          //logic here
    }
}
 
When I modify the field on the form, I get the below error:  FormRun object does not have method 'methodA'.
 
Can anybody help me, please? 
Thanks in advance!
I have the same question (0)
  • Martin Dráb Profile Picture
    239,242 Most Valuable Professional on at
    A better approach will be using a CoC extension of the data source and referring the the form by element variable.
  • Suggested answer
    Waed Ayyad Profile Picture
    9,108 Super User 2026 Season 1 on at
    Hi,
     
    Use the FormDataSourceField COC and add your method there.
     
    [ExtensionOf(formDataFieldStr(ProjTable, ProjTable, FieldA))]
    final class XXXProjTable_ProjTableFieldA_Extension
    {
        public void modified()
        {
            FormDataObject formDataObject = any2Object(this) as FormDataObject;
            FormDataSource formDataSource = formDataObject.datasource();
    
            next modified();
    ​​​​​​​ this.MethodA(); } public void methodA() { //logic here } }
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
  • Suggested answer
    Waed Ayyad Profile Picture
    9,108 Super User 2026 Season 1 on at
    Hi,

    Is your issue resolved?  If yes, mark the answers that helped you as verified.

    Thanks
    Waed Ayyad
  • Waed Ayyad Profile Picture
    9,108 Super User 2026 Season 1 on at
    Hi,

    Is your issue resolved?  If yes, mark the answers that helped you as verified.

    Thanks
    Waed Ayyad

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 653

#2
André Arnaud de Calavon Profile Picture

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

#3
CP04-islander Profile Picture

CP04-islander 298

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans