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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Why does my FormDataSource not recognize its method

(0) ShareShare
ReportReport
Posted on by 339

[ExtensionOf(formDataSourceStr(PurchTable, PurchTable))]
internal final class FM_Datasource_PurchTable_PurchTable_Extension
{
    [FormDataFieldEventHandler(formDataFieldStr(PurchTable, PurchTable, CurrencyCode),FormDataFieldEventType::Modified)]
    public static void onModified_CurrencyCode(FormDataObject _dataObject, FormDataFieldEventArgs _args)
    {
        _dataObject.datasource().modified_CurrencyCode();
    }

    public void modified_CurrencyCode()
    {
        str x = 'test';
    }

}

I simply added an eventHandler where I call the method that I added to the class myself, but the compiler does not recognize the modified_CurrencyCode method and returns as error:

Error ClassDoesNotContainMethod: Class 'FormDataSource' does not contain a definition for method 'thisIsATest' and no extension method 'thisIsATest' accepting a first argument of type 'FormDataSource' is found on any extension class.

Does anyone know what could cause this issue?

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,843 Moderator on at

    Hi SuperBunny,

    Don't combine event handler and COC in one class. It will be better if you create separate class.

    For the issue try assigning the sender to Object and then call the datasource method.

    [ExtensionOf(formDataSourceStr(PurchTable, PurchTable))]
    internal final class FM_Datasource_PurchTable_PurchTable_Extension
    {
        [FormDataFieldEventHandler(formDataFieldStr(PurchTable, PurchTable, CurrencyCode),FormDataFieldEventType::Modified)]
        public static void onModified_CurrencyCode(FormDataObject _dataObject, FormDataFieldEventArgs _args)
        {
            Object purchTable = _dataObject;
            purchTable.modified_CurrencyCode();
        }
    
        public void modified_CurrencyCode()
        {
            str x = 'test';
        }
    
    }

    Thanks,

    Girish S.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 461 Super User 2026 Season 1

#2
André Arnaud de Calavon Profile Picture

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

#2
Subra Profile Picture

Subra 428

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans