Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Extending PurchFormLetter_Confirmation class

(0) ShareShare
ReportReport
Posted on by 263

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

  • Celeste Profile Picture
    Celeste 263 on at
    RE: Extending PurchFormLetter_Confirmation class

    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

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,836 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans