microsoft / ALAppExtensions

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

[Event Request] Codeunit 5901 ServLoanerManagement - OnBeforeInsertLoanerEntry #27017

Closed 1languste closed 3 weeks ago

1languste commented 1 month ago

Describe the request

I would like to set additional field values before the Loaner Entry is inserted. Therefore, I request the following event:

procedure LendLoaner(ServItemLine: Record "Service Item Line")
var
    Loaner: Record Loaner;
    ServHeader: Record "Service Header";
    LoanerEntry: Record "Loaner Entry";
    ServLogMgt: Codeunit ServLogManagement;
begin
    if ServItemLine."Loaner No." <> '' then begin
        // ...
        LoanerEntry."Date Received" := 0D;
        LoanerEntry."Time Received" := 0T;
        LoanerEntry.Lent := true;
        // NEW BEGIN
        OnBeforeInsertLoanerEntry(LoanerEntry, ServItemLine);
        // NEW END
        LoanerEntry.Insert();
        Clear(ServLogMgt);
        ServLogMgt.LoanerLent(LoanerEntry);
    end else
        Error(Text000, ServItemLine.FieldCaption("Loaner No."));
end;

[IntegrationEvent(false, false)]
local procedure OnBeforeInsertLoanerEntry(var LoanerEntry: Record "Loaner Entry"; ServItemLine: Record "Service Item Line")
begin
end;

Additional context

I want to copy the value of a custom field from the Service Item Line to the Loaner Entry. Internal work item: AB#545033

JesperSchulz commented 3 weeks 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: 23206.