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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Extending PurchFormLetter_Confirmation class

(0) ShareShare
ReportReport
Posted on by 293

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
    293 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

News and Announcements

Season of Giving Solutions is Here!

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
TAHER Mehdi Profile Picture

TAHER Mehdi 3

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
Volodya Profile Picture

Volodya 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans