Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Add new method in datasource of the extension form?

(0) ShareShare
ReportReport
Posted on by 15

Hello Guys, a the simple question.

I need add new method in the datasource of the extension form. it´s possible? 

I have searched various forums but have not found the answer to the question. To clarify, I don't want to override any method, I want to add a custom method.
I'm sorry if the question is basic, but honestly I'm new and I don't know how to do it.

From already thank you very much.

  • Verified answer
    Komi Siabi Profile Picture
    Komi Siabi 12,759 Most Valuable Professional on at
    RE: Add new method in datasource of the extension form?

    Hi Angel, 

    Display method should rather be written on the table extension. 

  • Angel Profile Picture
    Angel 15 on at
    RE: Add new method in datasource of the extension form?

    I have added a method from the extension.

    [ExtensionOf(formStr(TaxTmpWorkTrans))]
    final class NXRTaxTmpWorkTransFrm_Extension
    {
        Display String30 displayMethod(TmpTaxWorkTrans _TmpTaxWorkTrans)
        {
            return TaxTable::find(_TmpTaxWorkTrans.TaxCode).field;
        }
    
    }

    but when I call it from the properties of the datamethod in my form control, it tells me that the method does not exist.

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Add new method in datasource of the extension form?

    Hi,

    Yes, you can add it via COC of form DataSource.

    [extensionof(formDatasourceStr(formName,DataSourceName))]
    Internal final class FormName_Extension
    {
        public void method1()
        {
            //you can call this method anywhere using datasource buffer. Dont look for Intellisense to show the
            custom method. Just type in the method name and it will work.
        }
    }

    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…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,817 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans