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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Extending PurchFormLetter_Confirmation class

(0) ShareShare
ReportReport
Posted on by 301

I’m trying to extend the code behind purchase order confirmation. There is a custom requirement based on confirmation of PO’s.

I’m still unfamiliar on extending the functionality.

 

I’ve added a post handler for the newConfirmation method on the PurchFormLetter_Confirmation class.

My code does get hit, but the variable I set equal to the class returns null.

Please help with my syntax. My class looks like this:

 

[ExtensionOf(classStr(PurchFormLetter_Confirmation))]

final class IMXPurchFormLetter_Confirm_FDD38_Extension

{

   /// <summary>

   ///

   /// </summary>

   /// <param name="args"></param>

   [PostHandlerFor(classStr(PurchFormLetter_Confirmation), staticMethodStr(PurchFormLetter_Confirmation, newConfirmation))]

   public static void PurchFormLetter_Confirmation_Post_newConfirmation(XppPrePostArgs args)

   {

       PurchFormLetter_Confirmation   purchFormLtrConf = args.getThis();

       PurchTable                     purchTbl;

 

       if (purchFormLtrConf.parmCallerTable().TableId == tableNum(PurchTable))

       {

//the above if statement throws error “Object reference not set to an instance of an object.” Because my variable purchFormLtrConf is null.

 

What am I doing wrong?

*This post is locked for comments

I have the same question (0)
  • Celeste Profile Picture
    301 on at

    To answer my own question: extending static methods not allowed.  Got around the issue by extending the run method from the PurchFormLetter class.  Here is a code snippet:

    [ExtensionOf(classStr(PurchFormLetter_Confirmation))]

    final class IMXPurchFormLetter_Confirm_FDD38_Extension

    {

       /// <summary>

       ///

       /// </summary>

       /// <param name="args"></param>

       [PostHandlerFor(classStr(PurchFormLetter), methodStr(PurchFormLetter, run))]

       public static void PurchFormLetter_Confirmation_Post_run(XppPrePostArgs args)

       {

           PurchFormLetter_Confirmation     purchFormLetter = args.getThis();

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Sagar Suman Profile Picture

Sagar Suman 2 Super User 2026 Season 1

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans