Hi All,
I'm trying to add an event handler for ViewEdit mode changed on any standard form, the following code works fine on any custom form, now trying to achieve the same on standard forms, here VendTable.
The simplified version of code is unable to compile:
[ExtensionOf(FormStr(VendTable))] final class VendTable_Extension { public void OnViewEditModeChanged() { //DOSomething } public void init() { next init(); this.viewEditModeHelper().EditModeSwitched = eventhandler(this.OnViewEditModeChanged); this.viewEditModeHelper().ViewModeSwitched = eventhandler(this.OnViewEditModeChanged); } }
This code produces the following compiler error:
Error ClassDoesNotContainMethod: Form 'Dynamics.AX.Application.VendTable' does not contain a definition for method 'OnViewEditModeChanged' and no extension method 'OnViewEditModeChanged' accepting a first argument of type 'Dynamics.AX.Application.VendTable' is found on any extension class.
When running the same on a custom form, compiler has no issues:
[Form] public class AAATest extends FormRun { public void OnViewEditModeChanged() { //DOSomething } public void init() { super(); this.viewEditModeHelper().EditModeSwitched = eventhandler(this.OnViewEditModeChanged); this.viewEditModeHelper().ViewModeSwitched = eventhandler(this.OnViewEditModeChanged); } }
The only difference I can notice is the use of COC on a standard form versus using a custom form without COC.
Happy to discuss, Thanks