Skip to content

[Event Request] Codeunit 99000818 "Mfg. Carry Out Action" - OnBeforeCarryOutActionsFromProdOrderCaseStatement #29827

@LorenzoSartori-NBT

Description

@LorenzoSartori-NBT

Why do you need this change?

Following the rejection of issue #29709 and the recommendations provided by the Microsoft team, I am requesting a NEW event with an IsHandled pattern in Codeunit 99000818 "Mfg. Carry Out Action", inside the CarryOutActionsFromProdOrder procedure.

We need to bypass the standard case statement based on the ProdOrderChoice parameter, regardless of the RequisitionLine."Action Message".

Describe the request

Please add the following new integration event:

[IntegrationEvent(false, false)]
local procedure OnBeforeCarryOutActionsFromProdOrderCaseStatement(var RequisitionLine: Record "Requisition Line"; ProdOrderChoice: Enum "Planning Create Prod. Order"; ProdWkshTempl: Code[10]; ProdWkshName: Code[10]; var TempDocumentEntry: Record "Document Entry" temporary; var sender: Codeunit "Carry Out Action"; var Result: Boolean; var IsHandled: Boolean)
begin
end;

And implement it inside the CarryOutActionsFromProdOrder procedure in Codeunit 99000818 "Mfg. Carry Out Action" as follows:

procedure CarryOutActionsFromProdOrder(RequisitionLine: Record "Requisition Line"; ProdOrderChoice: Enum "Planning Create Prod. Order"; ProdWkshTempl: Code[10]; ProdWkshName: Code[10]; var TempDocumentEntry: Record "Document Entry" temporary; var sender: Codeunit "Carry Out Action"): Boolean
var
IsHandled: Boolean;
Result: Boolean;
begin
PrintOrder := ProdOrderChoice = ProdOrderChoice::"Firm Planned & Print";
OnCarryOutActionsFromProdOrderOnAfterCalcPrintOrder(PrintOrder, ProdOrderChoice.AsInteger());
#if not CLEAN27
CarryOutAction.RunOnCarryOutActionsFromProdOrderOnAfterCalcPrintOrder(PrintOrder, ProdOrderChoice.AsInteger());
#endif

    // >>> NEW EVENT REQUEST
    IsHandled := false;
    OnBeforeCarryOutActionsFromProdOrderCaseStatement(RequisitionLine, ProdOrderChoice, ProdWkshTempl, ProdWkshName, TempDocumentEntry, sender, Result, IsHandled);
    if IsHandled then
        exit(Result);
    // <<< NEW EVENT REQUEST

    case RequisitionLine."Action Message" of
        RequisitionLine."Action Message"::New:
            if ProdOrderChoice = ProdOrderChoice::"Copy to Req. Wksh" then
                sender.CarryOutToReqWksh(RequisitionLine, ProdWkshTempl, ProdWkshName)
            else
                InsertProductionOrder(RequisitionLine, ProdOrderChoice, TempDocumentEntry);
        RequisitionLine."Action Message"::"Change Qty.",
        RequisitionLine."Action Message"::Reschedule,
        RequisitionLine."Action Message"::"Resched. & Chg. Qty.":
            exit(ProdOrderChgAndReshedule(RequisitionLine));
        RequisitionLine."Action Message"::Cancel:
            DeleteProdOrderLines(RequisitionLine);
    end;
    exit(true);
end;

Internal work item: AB#625529

Metadata

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM areaevent-requestRequest for adding an eventships-in-future-updateFix ships in a future update

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions