1
To assure that a procedure we are developing guarantees the same result as a user who manually enters a page, we sometimes need to publish an event of a standard codeunit.
To solve this need, several solutions could be adopted:
1. provide the possibility to create extensions for codeunits, in which public procedures can call the standard events of the codeunit itself to raise the standard event.
2. Add a "Publish" method to codeunit-type variables that temporary make public the local method used to raising an event.
## Examples
1.
codeunitextension 50000 "EXTTransfer Line Reserve" extends "Transfer Line Reserve"
{
events
{
procedure CallOnAfterCallItemTracking(var TransferLine: Record "Transfer Line")
begin
OnAfterCallItemTracking(TransferLine);
end;
}
}
2.
local procedure MyProcedure(var TransferLine: Record "Transfer Line"; Direction: option)
var
ReserveTranferLine: Codeunit "Transfer Line-Reserve";
begin
ReserveTranferLine.Publish('OnAfterCallItemTracking', True)
ReserveTranferLine.OnAfterCallItemTracking(TransferLine, Direction);
ReserveTranferLine.Publish('OnAfterCallItemTracking', false)
end;
To solve this need, several solutions could be adopted:
1. provide the possibility to create extensions for codeunits, in which public procedures can call the standard events of the codeunit itself to raise the standard event.
2. Add a "Publish" method to codeunit-type variables that temporary make public the local method used to raising an event.
## Examples
1.
codeunitextension 50000 "EXTTransfer Line Reserve" extends "Transfer Line Reserve"
{
events
{
procedure CallOnAfterCallItemTracking(var TransferLine: Record "Transfer Line")
begin
OnAfterCallItemTracking(TransferLine);
end;
}
}
2.
local procedure MyProcedure(var TransferLine: Record "Transfer Line"; Direction: option)
var
ReserveTranferLine: Codeunit "Transfer Line-Reserve";
begin
ReserveTranferLine.Publish('OnAfterCallItemTracking', True)
ReserveTranferLine.OnAfterCallItemTracking(TransferLine, Direction);
ReserveTranferLine.Publish('OnAfterCallItemTracking', false)
end;
STATUS DETAILS
Declined

Business Central Team (administrator)
Thank you for reaching out. Your suggestion seems to be an event request, request for making a function external or general code contribution in for a product. Please create an issue on one of following GitHub repos:
Event Requests, Requests for Externals, Extensibility enhancements: https://github.com/microsoft/ALAppExtensions/
AL language enhancements and development environment: https://github.com/microsoft/AL
Read more about finding right resource and providing feedback on this blog post:
https://community.dynamics.com/business/b/financials/archive/2018/12/04/find-the-right-resources-and-provide-feedback
Sincerely,
Brian Nielsen
PM, Microsoft