AX / D365FO – Override The JumpRef method On A Base Form with Chain of command

I want to override the standard behaviour when I click on CustTable_tutStoreId control of my CustTable Form

First create an extension class of your form and create a new method tutStoreIdJumpRef

[ExtensionOf(formStr(CustTable))]
final class tutCustTable_Form_Extension
{
    public void tutStoreIdJumpRef(FormControl _formControl)
    {
        Args args = new Args();
        MenuFunction menuFunction;
        RetailStoreTable  retailStoreTable;

        retailStoreTable = RetailStoreTable::find(_formControl.valueStr());
        args.record(retailStoreTable);
        menuFunction = new MenuFunction(menuitemdisplaystr(RetailStoreHours),MenuItemType::Display);
        menuFunction.run(args);
    }

}

Then override Init() method by using registerOverrideMethod()

public void init()
    {
        FormStringControl   formStringControl;

        next init();

        formStringControl = this.design().controlName(formControlStr(CustTable, CustTable_tutStoreId));
        formStringControl.registerOverrideMethod(methodStr(FormStringControl, jumpRef)
            , methodStr(tutCustTable_Form_Extension, tutStoreIdJumpRef));
    }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s