[Event Request] Table 5900 "Service Header"."Applies-to Doc. No."
lookup field 53 "Applies-to Doc. No" New event to give the possibility to validate if the field has been changed and to be able to update a new field that exists in the lines.
In table 36 there is the already created event to do this validation.
field(53; "Applies-to Doc. No."; Code[20]) { Caption = 'Applies-to Doc. No.';
trigger OnLookup()
var
GenJnlLine: Record "Gen. Journal Line";
GenJnlApply: Codeunit "Gen. Jnl.-Apply";
ApplyCustEntries: Page "Apply Customer Entries";
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforeLookupAppliesToDocNo(Rec, CustLedgEntry, IsHandled);
if IsHandled then
exit;
TestField("Bal. Account No.", '');
CustLedgEntry.SetApplyToFilters("Bill-to Customer No.", "Applies-to Doc. Type".AsInteger(), "Applies-to Doc. No.", Amount);
OnAfterSetApplyToFilters(CustLedgEntry, Rec);
ApplyCustEntries.SetSales(Rec, CustLedgEntry, SalesHeader.FieldNo("Applies-to Doc. No."));
ApplyCustEntries.SetTableView(CustLedgEntry);
ApplyCustEntries.SetRecord(CustLedgEntry);
ApplyCustEntries.LookupMode(true);
if ApplyCustEntries.RunModal = ACTION::LookupOK then begin
ApplyCustEntries.GetCustLedgEntry(CustLedgEntry);
GenJnlApply.CheckAgainstApplnCurrency(
"Currency Code", CustLedgEntry."Currency Code", GenJnlLine."Account Type"::Customer, true);
"Applies-to Doc. Type" := CustLedgEntry."Document Type";
"Applies-to Doc. No." := CustLedgEntry."Document No.";
**OnAfterAppliesToDocNoOnLookup**(Rec, CustLedgEntry);
end;
Clear(ApplyCustEntries);
end;
trigger OnValidate()
begin
OnBeforeValidateAppliesToDocNo(Rec, CustLedgEntry);
if "Applies-to Doc. No." <> '' then
TestField("Bal. Account No.", '');
if ("Applies-to Doc. No." <> xRec."Applies-to Doc. No.") and (xRec."Applies-to Doc. No." <> '') and
("Applies-to Doc. No." <> '')
then begin
CustLedgEntry.SetAmountToApply("Applies-to Doc. No.", "Bill-to Customer No.");
CustLedgEntry.SetAmountToApply(xRec."Applies-to Doc. No.", "Bill-to Customer No.");
end else
if ("Applies-to Doc. No." <> xRec."Applies-to Doc. No.") and (xRec."Applies-to Doc. No." = '') then
CustLedgEntry.SetAmountToApply("Applies-to Doc. No.", "Bill-to Customer No.")
else
if ("Applies-to Doc. No." <> xRec."Applies-to Doc. No.") and ("Applies-to Doc. No." = '') then
CustLedgEntry.SetAmountToApply(xRec."Applies-to Doc. No.", "Bill-to Customer No.");
end;
}
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. We will update this issue with information about availability. 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.