Skip to content

[Improvement] Extract to Procedure could avoid var for paramater variables #157

@pri-kise

Description

@pri-kise

If I have an eventsubscriber with some code and extract this code to a procedure all variables are added as var paramter.
Although the orginial event subscriber parameter (e.g. SalesHeader : Record SalesHeader is only passed by value.

[EventSubscriber(ObjectType::Table, Database::"Gen. Journal Line", 'OnAfterCopyGenJnlLineFromSalesHeader', '', false, false)]
local procedure GenJournalLine_OnAfterCopyGenJnlLineFromSalesHeader(SalesHeader: Record "Sales Header"; var GenJournalLine: Record "Gen. Journal Line")
begin
    DoMagic(SalesHeader, GenJournalLine);
end;
//local procedure DoMagic(var SalesHeader: Record "Sales Header"; var GenJournalLine: Record "Gen. Journal Line") // Current Behaviour

//>> Improvement
local procedure DoMagic(SalesHeader: Record "Sales Header"; var GenJournalLine: Record "Gen. Journal Line") // Current Behaviour
//<< Improvement
begin
   if SalesHeader
end;

If possible in this specific scenario the parameter could be created without var in my opinion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions