Skip to content

[Event Request] Codeunit 80 "Sales-Post" - Job entries #29309

@krpr-navax

Description

@krpr-navax

Why do you need this change?

We would like to request new integration events in the Sales-Post codeunit, which concerns job related operations. As this check is executed for every line being posted, the overhead for bulk operations is incredibly high, even though the functionality is not in use by any of our customers. To improve performance during our bulk posting operations, the events will be subscribed using manual subscription to skip these costly executions for each line.

Describe the request

Object: codeunit 80 "Sales-Post"
Procedure: ArchiveRelatedJob

Code:

#if NEWEVENTS
    [IntegrationEvent(false, false)]
    local procedure OnBeforeArchiveRelatedJob(SalesHeader: Record "Sales Header"; var IsHandled: Boolean)
    begin
    end;
#endif

    local procedure ArchiveRelatedJob(SalesHeader: Record "Sales Header")
    var
        Job: Record Job;
        SalesLine: Record "Sales Line";
        JobArchiveManagement: Codeunit "Job Archive Management";
#if NEWEVENTS
        IsHandled: Boolean;
    begin
        OnBeforeArchiveRelatedJob(SalesHeader, IsHandled);
        if IsHandled then
            exit;
#endif

        SalesLine.SetRange("Document Type", SalesHeader."Document Type");
        SalesLine.SetRange("Document No.", SalesHeader."No.");
        SalesLine.SetFilter("Job No.", '<>%1', '');
        if not SalesLine.FindFirst() then
            exit;

        if Job.Get(SalesLine."Job No.") then
            JobArchiveManagement.AutoArchiveJob(Job);
    end;

Internal work item: AB#610440

Metadata

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM areaevent-requestRequest for adding an event

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions