Skip to content

[Event Request] Codeunit 5642 "FA Reclass. Transfer Line" #29655

@MarZil97

Description

@MarZil97

Why do you need this change?

Please add an integration event before the standard TestField(Inactive, false) validations in procedure FAReclassLine.
The event must include an IsHandled flag to allow extensions to bypass the standard inactive FA validation.

Alternatives Evaluated: There are no existing events that we could use for this scenario. We need to avoid testing the Inactive field by conditionally skipping the validation using custom logic.

Justification for IsHandled: The IsHandled flag is required because the standard logic must be skipped if it does not meet the custom IF condition.

Performance Considerations: The event is triggered only when the system executes the FAReclassLine procedure, the validation of the Inactive field on Fixed Assets is about to occur. The event itself introduces no additional database access, no loops or repeated execution beyond the existing reclassification logic. The expected performance impact is minimal and consistent with other IsHandled integration events in Fixed Assets posting logic in Business Central.

Data Sensitivity Review: The event exposes only Fixed Asset, FA Reclassification Journal Line, and the IsHandled flag. It does not include Personal data, sensitive or regulated information. The event does not introduce any additional data access or data persistence.
There are no additional data security or privacy implications.

Multi Extension Interaction: Extensions that rely on this event must coordinate via dependency declarations. Partners can use EventSubscriberInstance = Manual to control execution order. The pattern is consistent with other core IsHandled events, so developers are familiar with the implications.

Example of our custom code:

procedure FAReclassLine(var FAReclassJnlLine: Record "FA Reclass. Journal Line"; var Done: Boolean)
    var
        IsHandled: Boolean;
    begin
        IsHandled := false;
        OnBeforeFAReclassLine(FAReclassJnlLine, Done, IsHandled);
        if IsHandled then
            exit;

        if (FAReclassJnlLine."FA No." = '') and (FAReclassJnlLine."New FA No." = '') then
            exit;
        OldFA.Get(FAReclassJnlLine."FA No.");
        NewFA.Get(FAReclassJnlLine."New FA No.");
        FADeprBook.Get(FAReclassJnlLine."FA No.", FAReclassJnlLine."Depreciation Book Code");
        FADeprBook2.Get(FAReclassJnlLine."New FA No.", FAReclassJnlLine."Depreciation Book Code");
        OldFA.TestField(Blocked, false);
        NewFA.TestField(Blocked, false);

        if not CustMgt.CheckPostOnInactiveFA() then begin //Custom condition
            OldFA.TestField(Inactive, false);
            NewFA.TestField(Inactive, false)
        end;

        if OldFA."Budgeted Asset" and not NewFA."Budgeted Asset" then
            FAReclassJnlLine.FieldError(
              "FA No.", StrSubstNo(Text000,
                OldFA.FieldCaption("Budgeted Asset"), FAReclassJnlLine.FieldCaption("New FA No.")));

      ...
     end;

Describe the request

procedure FAReclassLine(var FAReclassJnlLine: Record "FA Reclass. Journal Line"; var Done: Boolean)
    var
        IsHandled: Boolean;
    begin
        IsHandled := false;
        OnBeforeFAReclassLine(FAReclassJnlLine, Done, IsHandled);
        if IsHandled then
            exit;

        if (FAReclassJnlLine."FA No." = '') and (FAReclassJnlLine."New FA No." = '') then
            exit;
        OldFA.Get(FAReclassJnlLine."FA No.");
        NewFA.Get(FAReclassJnlLine."New FA No.");
        FADeprBook.Get(FAReclassJnlLine."FA No.", FAReclassJnlLine."Depreciation Book Code");
        FADeprBook2.Get(FAReclassJnlLine."New FA No.", FAReclassJnlLine."Depreciation Book Code");
        OldFA.TestField(Blocked, false);
        NewFA.TestField(Blocked, false);

        //>> Code change begins
        IsHandled := false;
        OnFaReclassLineOnBeforeTestFieldInactive(OldFA, NewFA, FAReclassJnlLine, IsHandled);
        if not IsHandled then begin 
            OldFA.TestField(Inactive, false);
            NewFA.TestField(Inactive, false)
        end;
        //<< Code change ends

        if OldFA."Budgeted Asset" and not NewFA."Budgeted Asset" then
            FAReclassJnlLine.FieldError(
              "FA No.", StrSubstNo(Text000,
                OldFA.FieldCaption("Budgeted Asset"), FAReclassJnlLine.FieldCaption("New FA No.")));

      ...
     end;

[IntegrationEvent(false, false)]
local procedure OnFaReclassLineOnBeforeTestFieldInactive(var OldFA: Record "Fixed Asset"; var NewFA: Record "Fixed Asset"; var FAReclassJnlLine: Record "FA Reclass. Journal Line"; var IsHandled)
begin
end;

Metadata

Metadata

Assignees

No one assigned

    Labels

    missing-infoThe issue misses information that prevents it from completion.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions