During my development I have to run a block of code before calling of method in a class. So when I tried to create a Pre-Event handler of the method it throws an error because of Protected access modifier of the method.
So what I have done to achieve this is that I have created an extension of a class and copied the protected method and defined my code block after that, then I have simply called the base method by using next keyword. By doing this I have given my own Pre-Event handler implementation without using any event handler as shown in below images.
Hi
ReplyDeleteI am facing same issue, to give color to label in whsworkexecuteform.xpp class where i want to get posteventhandler of createlabel() method which is protected.
How can i do this in my scenario.
Thanks
Priya
Hi priya,
ReplyDeletecreatelabel() is a hookable method. You can follow above blog this will help you. All you need to create a extension class of WhsWorkExecuteForm and in your extended class give implementation of this method. Or if you are facing any specific issue then please comment with screenshot if possible.
Thanks,
Tabsheer