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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to write the extension class for Existing Forms

(0) ShareShare
ReportReport
Posted on by

Hi Experts,

How to write the extension class for Existing Forms (Source Code Methods, Data Source Methods, Field Methods and control Methods) 
Chain of Command
 Your help will be much appreciated.
Thanks in advance,
Phani
I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Hi Phani AX2012,

    which version are you asking about? You posted in D365 forum, but used tags ax2012 and Dynamics 365?

    In AX2012 you can't write such extensions.

    In D365FO you can use Chain of Command, check this doc page: docs.microsoft.com/.../method-wrapping-coc

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at
  • Community Member Profile Picture
    on at

    Hi Ergun,

    Thanks for replying very fast.

    How to create new method under forms , datasources and fields inside the datasource for an exsting form. I have gone through link which is explaining for existing methods extension.

    Can you please help on this.

    Thanks,

    Phani

  • ergun sahin Profile Picture
    8,826 Moderator on at

    anithasantosh.wordpress.com/.../

  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Hi Phani,

    you can use Chain of Command to create new methods on objects. The syntax is exactly the same! The only difference is that you don't call next because there's no base method that you would call.

  • Community Member Profile Picture
    on at

    Hi Nikolaos,

    Thanks for coming forward to answer this question.

    Do I need to create separate xpp file in d365 for the methods that are under forms and data sources and fields in the extended form. Please confirm?

    Thanks,

    Phani

  • ergun sahin Profile Picture
    8,826 Moderator on at

    You can add newMothod in COC, and call that. Just dont forgot where are you creating method (form or ds or on a field)

    anithasantosh.wordpress.com/.../

  • Community Member Profile Picture
    on at

    Hi Ergun,

     Sorry I could not able to catch your point here.  I need to create a new  method  under the existing data source of existing form . How do I achieve this, Same way for existing fields. do i need to create separate class xpp files for ds and fields .

    Thanks,

    Phani

  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Each form data source, form control etc is a separate class and you need to create separate extension classes. 

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    [ExtensionOf(formDataSourceStr(SalesCreateOrder,SalesTable))]
    final class SalesCreateOrderDataSource_Extension
    {
        public void write()
        {
            next write();
            FormDataSource formDS = this;
            SalesTable salesTable = formDS.cursor();;
      
            this.setIsManualCreated();
        }
    
        public void setIsManualCreated()
        {
            salesTable.IsManualCreated = true;
        }
    
    }

    Instead of using COC for this case, Creating a event handler makes more sense, but the usage is that way.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 461 Super User 2026 Season 1

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2026 Season 1

#2
Subra Profile Picture

Subra 428

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans