-
Notifications
You must be signed in to change notification settings - Fork 687
Description
Why do you need this change?
The CalcSequenceFromActual procedure is called from Table 99000830 "Planning Routing Line" fields 70 and 72 OnValidate triggers with an uninitialized ReqLine parameter. This causes:
- Incorrect routing type passed to sequencing functions (uses default Serial=0 instead of actual value)
- Wrong operation scheduling in parallel routing scenarios
- No workaround available - cannot override table triggers in extensions
This bug affects manufacturing planning for companies using routing operations and is related to issues #29512 and #29607 (same root cause).
Why Request an Event (not just wait for bug fix)?
- Faster resolution
- Low risk: Adding event is non-breaking, requires minimal testing
- Partner enablement: Allows immediate workaround via subscriber
- Future-proof: Event remains useful for customizations even after bug fix
Describe the request
Add one Integration Event in Codeunit 99000808 PlanningRoutingManagement:
Event Location
At the beginning of procedure CalcSequenceFromActual (before first use of ReqLine parameter):
Current code (line ~238):
procedure CalcSequenceFromActual(PlanningRtngLine: Record "Planning Routing Line"; Direction: Option Forward,Backward; ReqLine: Record "Requisition Line")
var
PlanningRtngLine2: Record "Planning Routing Line";
MaxSeq: Integer;
begin
if NeedsCalculation(
ReqLine."Worksheet Template Name",
ReqLine."Journal Batch Name",
ReqLine."Line No.")
then
Calculate(ReqLine);
// ... rest of code uses ReqLine."Routing Type"
end;Requested change:
procedure CalcSequenceFromActual(PlanningRtngLine: Record "Planning Routing Line"; Direction: Option Forward,Backward; ReqLine: Record "Requisition Line")
var
PlanningRtngLine2: Record "Planning Routing Line";
MaxSeq: Integer;
begin
OnBeforeCalcSequenceFromActual(PlanningRtngLine, Direction, ReqLine); // ← NEW EVENT
if NeedsCalculation(
ReqLine."Worksheet Template Name",
ReqLine."Journal Batch Name",
ReqLine."Line No.")
then
Calculate(ReqLine);
// ... rest of code
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeCalcSequenceFromActual(PlanningRtngLine: Record "Planning Routing Line"; Direction: Option Forward,Backward; var ReqLine: Record "Requisition Line")
begin
end;Critical Requirement
The ReqLine parameter MUST be var to allow subscribers to initialize it.
Workaround Code
With this event, the workaround is straightforward:
[EventSubscriber(ObjectType::Codeunit, Codeunit::PlanningRoutingManagement, 'OnBeforeCalcSequenceFromActual', '', false, false)]
local procedure FixUninitializedReqLine(PlanningRtngLine: Record "Planning Routing Line"; Direction: Option; var ReqLine: Record "Requisition Line")
begin
if ReqLine."Line No." = 0 then // Detect uninitialized
ReqLine.Get(PlanningRtngLine."Worksheet Template Name", PlanningRtngLine."Worksheet Batch Name", PlanningRtngLine."Worksheet Line No.");
end;This mirrors the initialization pattern already present in CalculateRoutingFromActual (same codeunit, line ~516).
Additional Context
Objects affected:
- Codeunit 99000808 "PlanningRoutingManagement" (event location)
- Table 99000830 "Planning Routing Line" (caller with bug)
Related issues:
- [Event Request] codeunit 99000808 "PlanningRoutingManagement" OnBeforeSetRtngLineSequenceBack #29512: Same bug in field 70 "Starting Time"
- [Event Request] codeunit 99000808 "PlanningRoutingManagement" OnBeforeSetRtngLineSequenceForward #29607: Same bug in field 72 "Ending Time"
User scenario:
Manufacturing companies using Planning Worksheets with routing operations, particularly when Routing Type = Parallel.
BC Version tested: 27.3.44313.44463