1

I need to make some changes on closeOk of SalesEditLines form. As I know, I am not able to change the standard methods, so I need to create an event handler for closeOk.

[PreHandlerFor(formStr(SalesEditLines), formMethodStr(SalesEditLines, closeOk))]
public static void SalesEditLines_Pre_closeOk(XppPrePostArgs args)
{
    FormRun sender  = args.getThis() as FormRun;
    Object callerObject = sender.args().caller();
}

The question is - how can i access a SalesFormLetter through SalesEditLines form formRun using PreHandler?

rjv
  • 1,058
  • 11
  • 29
Effy Sille
  • 179
  • 1
  • 12

1 Answers1

2

You can see the following line in init method of SalesEditLines form

salesFormLetter = element.args().caller();

So your callerObject is an instance of SalesFormLetter class, you need just cast it to proper type.

Please check the following link: https://learn.microsoft.com/en-us/dynamicsax-2012/developer/expression-operators-is-and-as-for-inheritance

Aliaksandr Maksimau
  • 2,251
  • 12
  • 21