How to get ARGS from XppPrePostArgs in extension methos?

453 Views Asked by At

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.

1

There are 1 best solutions below

0
Alex Kwitny On BEST ANSWER

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");