Skip to main content

Notifications

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

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

    I see, just wanted to be sure.

    Thanks for the answers,

    Eisenberk.

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 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

  • Verified answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 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.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,111 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,934 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans