microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
748 stars 600 forks source link

[Event Request] Codeunit 1001 "Job Post-Line" - procedure InsertPlLineFromLedgEntry #26777

Closed mrabus closed 4 days ago

mrabus commented 5 days ago

Describe the request

I would like to add additional business logic after a Job Planning Line has been posted. Therefor, I request the following event:

        procedure InsertPlLineFromLedgEntry(var JobLedgEntry: Record "Job Ledger Entry")
    var
        JobPlanningLine: Record "Job Planning Line";
        IsHandled: Boolean;
    begin
        OnBeforeInsertPlLineFromLedgEntry(JobLedgEntry, IsHandled);
        if IsHandled then
            exit;

        if JobLedgEntry."Line Type" = JobLedgEntry."Line Type"::" " then
            exit;
        ClearAll();
        JobPlanningLine."Job No." := JobLedgEntry."Job No.";
        JobPlanningLine."Job Task No." := JobLedgEntry."Job Task No.";
        JobPlanningLine.SetRange("Job No.", JobPlanningLine."Job No.");
        JobPlanningLine.SetRange("Job Task No.", JobPlanningLine."Job Task No.");
        if JobPlanningLine.FindLast() then;
        JobPlanningLine."Line No." := JobPlanningLine."Line No." + 10000;
        JobPlanningLine.Init();
        JobPlanningLine.Reset();
        Clear(JobTransferLine);
        JobTransferLine.FromJobLedgEntryToPlanningLine(JobLedgEntry, JobPlanningLine);
        PostPlanningLine(JobPlanningLine);
        //NEW CODE
        OnAfterInsertPlLineFromLedgEntry(JobLedgEntry, JobPlanningLine);
       //NEW CODE
    end;

    //NEW CODE
    [IntegrationEvent(false, false)]
    local procedure OnAfterInsertPlLineFromLedgEntry(JobLedgEntry: Record "Job Ledger Entry"; JobPlanningLine: Record "Job Planning Line")
    begin
    end;

Additional context

I need to trigger additional business logic after the line is posted. The existing OnPostPlanningLineOnBeforeJobPlanningLineInsert event doesn't work for me, as I need the line to be inserted. Thank you Internal work item: AB#540044

JesperSchulz commented 4 days ago

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.

Build ID: 21513.