The CodeUnit 1535 “Approvals Mgmt.” has the function ‘SendApprovalRequestFromApprovalEntry’ that I want to replace by my new function in my new CodeUnit.
I know that we cannot modify standard objects, so I created a new CodeUnit but I need to prevent the execution of the standard function.
Thanks in advance.
The short answer is “it depends on how\where the function you want to replace is called”. Can that area of the program be extended to accomplish your needs? One example is a Page action that runs a function you want to replace. You could extend the page to hide the standard action and replace it with a custom action that runs your code instead.
The function you mention got an event publisher using the “handled” design pattern, which allows you to “replace” it with your own:
OnBeforeSendApprovalRequestFromApprovalEntry(ApprovalEntry, WorkflowStepInstance, IsHandled);
All you need to do is to create a subscriber function and return IsHandled = TRUE, this will make it exit after running your code. Even if that code is no code.
But be aware, that if you have other extensions subscribing to the same event, then they may return FALSE or do something different.