Notifications
Announcements
No record found.
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
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.
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.
D 365
Answer is already given . Did you check my reply ?
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
once you get the datasource just put datasource_ds.yourMethodname() . It doesn't show your method when you indent but it works
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
which line you are getting this error ?
In First line also i m getting error:
i just wrote the two lines of code.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Priya_K 4
Martin Dráb 4 Most Valuable Professional
MyDynamicsNAV 2