Why do you need this change?
We need to conditionally skip the if SelectionReq then block inside OnAfterGetRecord on the "Purchase Line" dataitem based on lot status exclusion rules. Our customization fetches the Item record for the current purchase line and calls LotStatusMgmt.SetInboundExclusions to determine whether purchase receipts are excluded from planning for that item. If ExcludePurch is true, the entire scheduling block must be skipped.
The SetInboundExclusions function evaluates the lot status configuration for the item and returns exclusion flags per supply type purchase, sales return, and output. These flags are item-specific and can only be determined at runtime when the actual item record is available. The base app has no awareness of these exclusion flags and will unconditionally proceed into the scheduling block for every purchase line where SelectionReq is true, regardless of whether that item's lot status marks it as excluded from planning.
There is no event before the if SelectionReq then block that exposes the current "Purchase Line" record and allows a subscriber to suppress execution via an IsHandled guard. Without this event there is no clean extensibility point to intercept and conditionally bypass the base app scheduling logic from an extension.
Describe the request
Add an integration event OnAfterGetRecordPurchaseLineBeforeSelection in OnAfterGetRecord on the "Purchase Line" dataitem before the if SelectionReq then block
trigger OnAfterGetRecord()
begin
ReqLine2.SetRange("Ref. Order No.", "Document No.");
ReqLine2.SetRange("Ref. Line No.", "Line No.");
if ReqLine2.FindFirst() then
CurrReport.Skip();
IsHandled := false;
OnAfterGetRecordPurchaseLineBeforeSelection("Purchase Line", IsHandled);
if not IsHandled then
if SelectionReq then begin
NewRecordWithDetails("Expected Receipt Date", "No.", Description);
TempPlanningBuffer."Document Type" := TempPlanningBuffer."Document Type"::"Purchase Order";
TempPlanningBuffer."Document No." := "Document No.";
TempPlanningBuffer."Scheduled Receipts" := "Outstanding Qty. (Base)";
TempPlanningBuffer.Insert();
end else begin
TempPlanningBuffer.SetRange("Item No.", "No.");
TempPlanningBuffer.SetRange(Date, "Expected Receipt Date");
if TempPlanningBuffer.Find('-') then begin
TempPlanningBuffer."Scheduled Receipts" := TempPlanningBuffer."Scheduled Receipts" + "Outstanding Qty. (Base)";
TempPlanningBuffer.Modify();
end else begin
NewRecordWithDetails("Expected Receipt Date", "No.", Description);
TempPlanningBuffer."Scheduled Receipts" := "Outstanding Qty. (Base)";
TempPlanningBuffer.Insert();
end;
end;
end;
Event Signature:
[IntegrationEvent(false, false)]
local procedure OnAfterGetRecordPurchaseLineBeforeSelection(var PurchaseLine: Record "Purchase Line"; var IsHandled: Boolean)
begin
end;
Alternatives evaluated:
A report extension's OnAfterGetRecord runs in addition to the base app trigger, not instead of it, so there is no way to suppress the base app's if SelectionReq then block from an extension without an IsHandled guard. No event currently exists before the if SelectionReq then block in this trigger.
Why do you need this change?
We need to conditionally skip the if
SelectionReqthen block insideOnAfterGetRecordon the "Purchase Line" dataitem based on lot status exclusion rules. Our customization fetches the Item record for the current purchase line and callsLotStatusMgmt.SetInboundExclusionsto determine whether purchase receipts are excluded from planning for that item. IfExcludePurchis true, the entire scheduling block must be skipped.The
SetInboundExclusionsfunction evaluates the lot status configuration for the item and returns exclusion flags per supply type purchase, sales return, and output. These flags are item-specific and can only be determined at runtime when the actual item record is available. The base app has no awareness of these exclusion flags and will unconditionally proceed into the scheduling block for every purchase line whereSelectionReqis true, regardless of whether that item's lot status marks it as excluded from planning.There is no event before the if
SelectionReqthen block that exposes the current "Purchase Line" record and allows a subscriber to suppress execution via anIsHandledguard. Without this event there is no clean extensibility point to intercept and conditionally bypass the base app scheduling logic from an extension.Describe the request
Add an integration event
OnAfterGetRecordPurchaseLineBeforeSelectioninOnAfterGetRecordon the"Purchase Line"dataitem before the ifSelectionReqthen blockEvent Signature:
Alternatives evaluated:
A report extension's OnAfterGetRecord runs in addition to the base app trigger, not instead of it, so there is no way to suppress the base app's if SelectionReq then block from an extension without an IsHandled guard. No event currently exists before the if SelectionReq then block in this trigger.