Search code examples
axaptax++dynamics-ax-2012dynamics-365

How to get ARGS from XppPrePostArgs in extension methos?


I extended the main class method, I would like to get from XppPrePostArgs the Args in D365 environment.

[PreHandlerFor(classStr(MYCLASS), staticMethodStr(MYCLASS, main))]
public static void MYCLASS_Pre_main(XppPrePostArgs args)
{
     // HOW TO CONVERT args to 
    //   from XppPrePostArgs  get Args
}

Thanks.


Solution

  • You're not converting anything in the traditional inheritance sense. You're using XppPrePostArgs to obtain the event's variable(s).

    // Change "_args" to whatever the argument variable name is

    Args args = _xppPrePostArgs.getArg("_args");