Skip to content

[Event Request] Codeunit 6721 "Booking Manager" - Custom evaluation in CanHandleLine #29305

@krpr-navax

Description

@krpr-navax

Why do you need this change?

We would like to request a new integration event in the CanHandleLine procedure to allow for custom logic to determine whether a Sales Line should be processed in the Booking logic. As this check is executed for every single invoice 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 event will be subscribed using manual subscription to skip these costly executions for each line.

Describe the request

Object: codeunit 6721 "Booking Manager"
Procedure: CanHandleLine

Current Code:

local procedure CanHandleLine(var SalesLine: Record "Sales Line"): Boolean
begin
    if SalesLine.IsTemporary then
        exit(false);

    if SalesLine."Document Type" <> SalesLine."Document Type"::Invoice then
        exit(false);

    exit(true);
end;

New Code:

[IntegrationEvent(false, false)]
local procedure OnCanHandleLine(var SalesLine: Record "Sales Line"; var HandleLine: Boolean; var IsHandled: Boolean)
begin
end;

local procedure CanHandleLine(var SalesLine: Record "Sales Line") HandleLine: Boolean
var
    IsHandled: Boolean;
begin
    if SalesLine.IsTemporary then
        exit(false);

    OnCanHandleLine(SalesLine, HandleLine, IsHandled);
    if IsHandled then
        exit;

    if SalesLine."Document Type" <> SalesLine."Document Type"::Invoice then
        exit(false);

    exit(true);
end;

Internal work item: AB#610409

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