-
Notifications
You must be signed in to change notification settings - Fork 687
Description
Why do you need this change?
I am working on a migration from NAV to Business Central. In the legacy version, inside the ShowCustomProdItemAvailByBOMLevel procedure, we executed custom logic on the ItemAvailByBOMLevel page instance before running it. This was necessary to pass specific data and state from the Production Order Line to the page.
In the current Business Central version (Codeunit 99000875 "Prod. Order Availability Mgt."), the ItemAvailByBOMLevel page variable is local, and there is no event exposed before RunModal is called. This prevents us from accessing the page instance to perform our custom initialization.
We need an event that exposes the ItemAvailByBOMLevel page variable (by var) along with the context (ProdOrderLine, FieldCaption, OldDate) just before the page is run. This will allow us to subscribe to the event and execute our custom methods on the page instance.
Describe the request
Please add a new event OnBeforeShowCustomProdItemAvailByBOMLevelRunModal in Codeunit 99000875.
local procedure ShowCustomProdItemAvailByBOMLevel(var ProdOrderLine: Record "Prod. Order Line"; FieldCaption: Text[80]; OldDate: Date; var NewDate: Date): Boolean
var
ItemAvailByBOMLevel: Page "Item Availability by BOM Level";
begin
Clear(ItemAvailByBOMLevel);
ItemAvailByBOMLevel.InitSource(ProdOrderLine, "BOM Structure Show By"::Production);
ItemAvailByBOMLevel.InitDate(OldDate);
// START REQUEST
OnBeforeShowCustomProdItemAvailByBOMLevelRunModal(ItemAvailByBOMLevel, ProdOrderLine, FieldCaption, OldDate);
// STOP REQUEST
if FieldCaption <> '' then
ItemAvailByBOMLevel.LookupMode(true);
if ItemAvailByBOMLevel.RunModal() = ACTION::LookupOK then begin
NewDate := ItemAvailByBOMLevel.GetSelectedDate();
if OldDate <> NewDate then
if Confirm(ChangeConfirmationQst, true, FieldCaption, OldDate, NewDate) then
exit(true);
end;
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeShowCustomProdItemAvailByBOMLevelRunModal(var ItemAvailByBOMLevel: Page "Item Availability by BOM Level"; var ProdOrderLine: Record "Prod. Order Line"; FieldCaption: Text[80]; OldDate: Date)
begin
end;
Additional Information:
Performance Considerations: This event is triggered immediately before opening a UI page (RunModal). It is a user-interactive process, not a high-frequency loop. Adding an event publisher here has zero impact on system performance.
Data Sensitivity Review: The parameters exposed are the Page instance and the Production Order Line record. These contain standard operational data and do not involve sensitive PII or secret financial data beyond standard user permissions.
Multi-Extension Interaction: This event allows subscribers to configure the page instance. Standard conflict resolution applies; if multiple extensions try to modify the same page instance properties, the last one wins, which is standard behavior for UI initialization events.
Internal work item: AB#622452