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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Datasource's current value on datasource's extension

(0) ShareShare
ReportReport
Posted on by 87

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 have the same question (0)
  • Verified answer
    GirishS Profile Picture
    27,825 Moderator on at
    RE: Datasource's current value on datasource's extension

    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.

  • Suggested answer
    Mohit Rampal Profile Picture
    12,563 Moderator on at
    RE: Datasource's current value on datasource's extension

    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.

    learn.microsoft.com/.../customize-model-elements-extensions

  • Eisenberk Profile Picture
    87 on at
    RE: Datasource's current value on datasource's extension

    I see, just wanted to be sure.

    Thanks for the answers,

    Eisenberk.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,188

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 593 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans