Hello,
Now that i am learning about datasource's extensions, I realized that in each method i have to create a table variable to get the current value using this:
TableName tableName = this.cursor();
It seems weird to me that i need to create a local cursor in each method, knowing that the form class is using a runtime table variable with the current cursor value. In Dynamics 20212 we could use directly the runtime variable.
Why is different in D365? Am I missing some performance logic here?
Regards,
Eisenberk
I see, just wanted to be sure.
Thanks for the answers,
Eisenberk.
Hi, Cursor method is used to get current record in form Datasource or table level. In Ax 2012, we don't need to use it and can call the buffer directly by Name due to overlayering concept but not in D365FO due to extensions we can't call the form dataSource buffer directly in extension class. There is no performance metric attached to it.
Hi Eisenberk,
Its mandatory to declare variable in COC or event handler classes to get the current form DataSource buffer and assign it to the variable.
This is the normal way of doing in D365 and nothing to do with performance.
If you are using event handler - Based on the type of event handler, you can get the form DataSource object from either form run - form control and get the current record using cursor method only.
In Ax 2012 there is no concept for extension - You can directly open any objects and do the changes as you want and accessing variables is easy.
But in D365 - You need to follow certain steps to do a extension. You can use either COC or event handler - Each will have own syntax and you need to create your own class to add the logic. Since you are adding the logic outside of the form - You need to declare a table variable and get the current record using cursor method only. This is the mandatory process and nothing to do with performace.
Thanks,
Girish S.
André Arnaud de Cal...
292,111
Super User 2025 Season 1
Martin Dráb
230,934
Most Valuable Professional
nmaenpaa
101,156