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 :
Microsoft Dynamics AX (Archived)

Get Form datasource method in class extension

(0) ShareShare
ReportReport
Posted on by

Hi All,

How to get the form datasource method in modified eventhandler in class extension.

Please help me.

Thanks for your valuable reply.

*This post is locked for comments

I have the same question (0)
  • Sebastian Mankowski Profile Picture
    305 on at

    What version of Dynamics you are talking about? 365 or AX 2012 R3? You tagged it as AX but there is no class extensions in AX.

  • Suggested answer
    Sukrut Parab Profile Picture
    71,735 Moderator on at

    You can get formDatasource from sender as shown below

    FormDataSource projTable_ds = sender.formRun().dataSource("ProjTable");

    another way is

    FormDataSource MyRandomTable_ds = sender.dataSource(formDataSourceStr(SomeForm, MyRandomTableDS)

    Once you have formDatasource you can easily access its methods.

  • Community Member Profile Picture
    on at

    D 365

  • Sukrut Parab Profile Picture
    71,735 Moderator on at

    Answer is already given . Did you check my reply ?

  • Community Member Profile Picture
    on at

    Hi Sukrut,

    Thanks for your reply.

    I already tried your suggestion but i cant able to call the datasource method.

    please help.

    Thanks

    Arun Joseph A

  • Sukrut Parab Profile Picture
    71,735 Moderator on at

    once you get the datasource just put datasource_ds.yourMethodname() . It doesn't show your method when you indent  but it works

  • Community Member Profile Picture
    on at

    Thanks for reply.

    Its throw error to me.

    This is my scenario:

    FormDataFieldEventHandler(formDataFieldStr(ForecastSales, ForecastSales, Currency), FormDataFieldEventType::Modified)]

       public static void Currency_OnModified(FormDataObject sender, FormDataFieldEventArgs e)

       {

         FormDataSource ForecastSales_ds =

         sender.datasource(formDataSourceStr(ForecastSales, ForecastSales));

         ForecastSales_ds.updateAmount();

        }

    its throw error FormDataObject.datasource,expect 0 arguments,but 1 specified

  • Sukrut Parab Profile Picture
    71,735 Moderator on at

    which line you are getting this error ?

  • Community Member Profile Picture
    on at

    In First line also i m getting error:

    i just wrote the two lines of code.

  • Suggested answer
    Sukrut Parab Profile Picture
    71,735 Moderator on at

    try this

    FormRun formRun = _sender.datasource().formRun();

    FormDataSource ForecastSales_ds = = formRun.dataSource(ForecastSales')

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Basit Profile Picture

Basit 1

#1
GL-01081504-0 Profile Picture

GL-01081504-0 1

#1
Roya Profile Picture

Roya 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans