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, ...
Unanswered

ClassDoesNotContainMethod

(0) ShareShare
ReportReport
Posted on by 4

Hi All,

I'm trying to add an event handler for ViewEdit mode changed on any standard form, the following code works fine on any custom form, now trying to achieve the same on standard forms, here VendTable.

The simplified version of code is unable to compile:

[ExtensionOf(FormStr(VendTable))]
final class VendTable_Extension
{
    public void OnViewEditModeChanged()
    {
        //DOSomething
    }

    public void init()
    {
        next init();
        this.viewEditModeHelper().EditModeSwitched  = eventhandler(this.OnViewEditModeChanged);
        this.viewEditModeHelper().ViewModeSwitched  = eventhandler(this.OnViewEditModeChanged);
    }

}

This code produces the following compiler error:

Error ClassDoesNotContainMethod: Form 'Dynamics.AX.Application.VendTable' does not contain a definition for method 'OnViewEditModeChanged' and no extension method 'OnViewEditModeChanged' accepting a first argument of type 'Dynamics.AX.Application.VendTable' is found on any extension class. 

When running the same on a custom form, compiler has no issues:

[Form]
public class AAATest extends FormRun
{
    public void OnViewEditModeChanged()
    {
        //DOSomething
    }

    public void init()
    {
        super();
        this.viewEditModeHelper().EditModeSwitched  = eventhandler(this.OnViewEditModeChanged);
        this.viewEditModeHelper().ViewModeSwitched  = eventhandler(this.OnViewEditModeChanged);
    }

}

The only difference I can notice is the use of COC on a standard form versus using a custom form without COC.

Happy to discuss, Thanks

I have the same question (0)
  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    I ran into something similar. I solved it by putting the event handler method to a class, rather then directly to the form.

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

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans