ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

Event Request - codeunit 99000858 "Mfg. Get Demand To Reserve" - OnSyncProdOrderComponentsOnBeforeInsertReservationWkshLine

Open JeremyOrgan-DC opened this issue 5 months ago • 4 comments

Why do you need this change?

This will allow us to change the logic that decides whether the worksheet line should be inserted or not. We would like it to take into account other demand available to reserve such as Purchase or Production Order Output. I have based it on the same event as in codeunit 99000839 "Sales Get Demand To Reserve" Existing alternatives evaluated: There are no other ways to control if the worksheet lines get inserted or not. Justification for bypass control: This copies the design already done for other functional areas such as sales for the reservation worksheet Performance considerations: This should not cause performance issues Data sensitivity review: No sensitive data exposed Multi-extension interaction: Copied existing design for other areas, The way it should be used needs an understanding of the functionality and why we are needing to change the current value of DoInsertReservationWkshLine.

Describe the request

codeunit 99000858 "Mfg. Get Demand To Reserve"
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Reservation Worksheet Mgt.", 'OnCalculateDemandOnAfterSync', '', true, false)] local procedure SyncProdOrderComponents(BatchName: Code[10]; var GetDemandToReserve: Report "Get Demand To Reserve") Code at end ....... if (ReservationWkshLine."Remaining Qty. to Reserve" > 0) and (ReservationWkshLine."Available Qty. to Reserve" > 0) then ReservationWkshLine.Insert(true); ...... Change to var DoInsertReservationWkshLine: Boolean; code DoInsertReservationWkshLine := (ReservationWkshLine."Remaining Qty. to Reserve" > 0) and (ReservationWkshLine."Available Qty. to Reserve" > 0); OnSyncProdOrderComponentsOnBeforeInsertReservationWkshLine(ReservationWkshLine, TempProdOrderComponent, DoInsertReservationWkshLine); if DoInsertReservationWkshLine then ReservationWkshLine.Insert(true); .. New Event [IntegrationEvent(false, false)] local procedure OnSyncProdOrderComponentsOnBeforeInsertReservationWkshLine(var ReservationWkshLine: Record "Reservation Wksh. Line"; var TempProdOrderComponent: Record "Prod. Order Component" temporary; var DoInsertReservationWkshLine: Boolean) begin end;

Would also be good to have the same pattern applied to codeunit 6485 "Serv. Get Demand To Reserve" - SyncServiceOrderLines, codeunit 99000847 "Job Planning Line Get Demand" - SyncJobPlanningLines, codeunit 929 "Asm. Get Demand To Reserve" - SyncAssemblyOrderLines

Many Thanks Internal work item: AB#639378

JeremyOrgan-DC avatar Jun 15 '26 14:06 JeremyOrgan-DC

Hi @JeremyOrgan-DC,

Thank you for your extensibility request. To help us process it efficiently, please update the issue to include the required information.

📚 Extensibility Guidelines

Missing Information:

  • Existing alternatives evaluated: Explain which existing events or extension approaches you considered for this scenario and why they do not work here.
  • Justification for bypass control: Explain why this needs subscriber-controlled skip/bypass behavior instead of a regular event or another redesign.
  • Performance considerations: Add a brief note on expected execution frequency and any anticipated performance impact.
  • Data sensitivity review: Confirm whether this change would expose any sensitive or private data.
  • Multi-extension interaction: Acknowledge possible conflicts if multiple extensions subscribe and modify the insert decision.

Please update the issue with the missing details. We'll automatically re-analyze once updated.

[!NOTE] Automatically generated by the Triage Agent — advisory only. An engineer will review before any action is taken.

[!TIP] Not accurate? Reply with /not-accurate (optional: add a short explanation). Your feedback improves future responses.

github-actions[bot] avatar Jun 15 '26 15:06 github-actions[bot]

This has now been updated with additional information requested

JeremyOrgan-DC avatar Jun 17 '26 12:06 JeremyOrgan-DC

✅ Analysis complete - ready for further processing


Implementation:

Add a subscriber-controlled DoInsertReservationWkshLine decision and corresponding OnBeforeInsertReservationWkshLine integration event in the SyncProdOrderComponents, SyncServiceOrderLines, SyncJobPlanningLines, and SyncAssemblyOrderLines procedures so the insert can be overridden before ReservationWkshLine.Insert(true) runs.

Location in the corresponding sync procedures:

DoInsertReservationWkshLine := (ReservationWkshLine."Remaining Qty. to Reserve" > 0) and
    (ReservationWkshLine."Available Qty. to Reserve" > 0);
OnSyncProdOrderComponentsOnBeforeInsertReservationWkshLine(ReservationWkshLine, TempProdOrderComponent, DoInsertReservationWkshLine);
if DoInsertReservationWkshLine then
    ReservationWkshLine.Insert(true);

DoInsertReservationWkshLine := (ReservationWkshLine."Remaining Qty. to Reserve" > 0) and
    (ReservationWkshLine."Available Qty. to Reserve" > 0);
OnSyncServiceOrderLinesOnBeforeInsertReservationWkshLine(ReservationWkshLine, TempServiceLine, DoInsertReservationWkshLine);
if DoInsertReservationWkshLine then
    ReservationWkshLine.Insert(true);

DoInsertReservationWkshLine := (ReservationWkshLine."Remaining Qty. to Reserve" > 0) and
    (ReservationWkshLine."Available Qty. to Reserve" > 0);
OnSyncJobPlanningLinesOnBeforeInsertReservationWkshLine(ReservationWkshLine, TempJobPlanningLine, DoInsertReservationWkshLine);
if DoInsertReservationWkshLine then
    ReservationWkshLine.Insert(true);

DoInsertReservationWkshLine := (ReservationWkshLine."Remaining Qty. to Reserve" > 0) and
    (ReservationWkshLine."Available Qty. to Reserve" > 0);
OnSyncAssemblyOrderLinesOnBeforeInsertReservationWkshLine(ReservationWkshLine, TempAssemblyLine, DoInsertReservationWkshLine);
if DoInsertReservationWkshLine then
    ReservationWkshLine.Insert(true);

Event Publisher (add at the end of the codeunit with other events):

[IntegrationEvent(false, false)]
local procedure OnSyncProdOrderComponentsOnBeforeInsertReservationWkshLine(var ReservationWkshLine: Record "Reservation Wksh. Line"; var TempProdOrderComponent: Record "Prod. Order Component" temporary; var DoInsertReservationWkshLine: Boolean)
begin
end;

[IntegrationEvent(false, false)]
local procedure OnSyncServiceOrderLinesOnBeforeInsertReservationWkshLine(var ReservationWkshLine: Record "Reservation Wksh. Line"; var TempServiceLine: Record "Service Line" temporary; var DoInsertReservationWkshLine: Boolean)
begin
end;

[IntegrationEvent(false, false)]
local procedure OnSyncJobPlanningLinesOnBeforeInsertReservationWkshLine(var ReservationWkshLine: Record "Reservation Wksh. Line"; var TempJobPlanningLine: Record "Job Planning Line" temporary; var DoInsertReservationWkshLine: Boolean)
begin
end;

[IntegrationEvent(false, false)]
local procedure OnSyncAssemblyOrderLinesOnBeforeInsertReservationWkshLine(var ReservationWkshLine: Record "Reservation Wksh. Line"; var TempAssemblyLine: Record "Assembly Line" temporary; var DoInsertReservationWkshLine: Boolean)
begin
end;

File: MfgGetDemandToReserve.Codeunit.al, ServGetDemandToReserve.Codeunit.al, JobPlanningLineGetDemand.Codeunit.al, AsmGetDemandToReserve.Codeunit.al

[!NOTE] Automatically generated by the Triage Agent — advisory only. An engineer will review before any action is taken.

[!TIP] Not accurate? Reply with /not-accurate (optional: add a short explanation). Your feedback improves future responses.

github-actions[bot] avatar Jun 17 '26 19:06 github-actions[bot]

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

AleksandricMarko avatar Jul 02 '26 09:07 AleksandricMarko