Skip to content

[Event Request] Table 246 "Requisition Line" - OnBeforeUpdateReplenishmentSystem #29840

@LorenzoSartori-NBT

Description

@LorenzoSartori-NBT

Why do you need this change?

We are migrating a legacy customization from Dynamics NAV to Business Central.
In our scenario, we have a custom boolean field on the Item table (e.g., "No Stockkeeping"). When a user changes the "Location Code" or "Variant Code" on a Requisition Line, the system automatically triggers the UpdateReplenishmentSystem() local procedure.

If our custom flag on the Item is set to true, we must completely bypass the standard logic that fetches the SKU parameters and updates the "Replenishment System".

Alternatives Evaluated:
We evaluated using the existing event OnBeforeValidateReplenishmentSystem. However, this event is triggered at the very end of the process, after the system has already executed Item.GetSKU("Location Code", "Variant Code") and evaluated the Subcontracting logic. We need to bypass the entire procedure from the beginning to avoid unnecessary database reads and standard evaluations that conflict with our custom item setup.

Justification for IsHandled:
An IsHandled pattern at the beginning of the UpdateReplenishmentSystem procedure is essential to allow partners to skip the standard replenishment recalculation based on custom Item/SKU routing rules, without affecting the rest of the OnValidate triggers of Location and Variant codes.

Describe the request

Please add a new integration event OnBeforeUpdateReplenishmentSystem with an IsHandled pattern at the beginning of the UpdateReplenishmentSystem local procedure in Table 246 "Requisition Line".

Requested Event Signature:

[IntegrationEvent(false, false)]
local procedure OnBeforeUpdateReplenishmentSystem(var RequisitionLine: Record "Requisition Line"; var IsHandled: Boolean)
begin
end;

local procedure UpdateReplenishmentSystem()
    var
        StockkeepingUnit: Record "Stockkeeping Unit";
        IsHandled: Boolean;
    begin
        // >>> NEW EVENT REQUEST
        IsHandled := false;
        OnBeforeUpdateReplenishmentSystem(Rec, IsHandled);
        if IsHandled then
            exit;
        // <<< NEW EVENT REQUEST

        GetItem();
        StockkeepingUnit := Item.GetSKU("Location Code", "Variant Code");
        if Subcontracting then
            StockkeepingUnit."Replenishment System" := StockkeepingUnit."Replenishment System"::"Prod. Order";
        ValidateReplenishmentSystem(StockkeepingUnit);
    end;

Metadata

Metadata

Assignees

No one assigned

    Labels

    missing-infoThe issue misses information that prevents it from completion.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions