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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

New line of code in middle of a method through extension in d365fo

(0) ShareShare
ReportReport
Posted on by 409
Hello, 
I will need to be able to call a parm method on a contract class which falls in the middle of the method (Form method) and this Contract class is then supplied to another class.
Functionality is there are 2 custom fields on a worker. 
Is this even feasible?
Thanks
I have the same question (0)
  • Suggested answer
    Kevin Xia Profile Picture
    Microsoft Employee on at
    Hi,
    it is feasible to insert new lines of code in the middle of a method using extension techniques. Specifically, you can achieve this through the use of method wrapping in extension classes. Here's a general approach:
    Create an Extension Class:
    • Create an extension class for the target class where you want to insert code.
    • In the extension class, create a new method or use an existing one to add your custom logic.
    Use Chain of Command:
    • Use the chain of command framework to wrap the method you want to extend.
    • Inside the wrapper method, call the original method using next and then insert your custom code before or after the original call.
    Call a Parm Method:
    • If your contract class has a parameter method (parm method), you can call it within your custom logic.
    Supply Contract Class:
    • After adding your custom code, you can then supply the modified contract class to another class or method.
    Best regards,
    Kevin
  • Layan Jwei Profile Picture
    8,124 Super User 2025 Season 2 on at
    Hi SKO,

    can you please provide more details? maybe share with us the code and let us know what you exactly want to do. it will be easier for us to imagine the scenario

    Thanks,
    Layan Jweihan

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 669 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

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

#3
Martin Dráb Profile Picture

Martin Dráb 384 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans