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
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();
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,836
Most Valuable Professional
nmaenpaa
101,156