procedure OnModify(var Vend: Record Vendor)
var
Cont: Record Contact;
OldCont: Record Contact;
ContBusRel: Record "Contact Business Relation";
ContNo: Code[20];
NoSeries: Code[20];
SalespersonCode: Code[20];
IsHandled: Boolean;
begin
with ContBusRel do begin
SetCurrentKey("Link to Table", "No.");
SetRange("Link to Table", "Link to Table"::Vendor);
SetRange("No.", Vend."No.");
if not FindFirst then
exit;
if not Cont.Get("Contact No.") then begin
Delete();
Session.LogMessage('0000B36', StrSubstNo(VendContactUpdateTelemetryMsg, "Contact No.", "Business Relation Code"), Verbosity::Normal, DataClassification::EndUserIdentifiableInformation, TelemetryScope::ExtensionPublisher, 'Category', VendContactUpdateCategoryTxt);
exit;
end;
OldCont := Cont;
end;
ContNo := Cont."No.";
NoSeries := Cont."No. Series";
SalespersonCode := Cont."Salesperson Code";
OnBeforeTransferFieldsFromVendToCont(Cont, Vend);
Cont.Validate("E-Mail", Vend."E-Mail");
Cont.TransferFields(Vend);
OnAfterTransferFieldsFromVendToCont(Cont, Vend);
IsHandled := false;
OnModifyOnBeforeAssignNo(Cont, IsHandled);
if not IsHandled then begin
Cont."No." := ContNo;
Cont."No. Series" := NoSeries;
end;
Cont."Salesperson Code" := SalespersonCode;
Cont.Validate(Name);
Cont.DoModify(OldCont);
Cont.Modify(true);
Vend.Get(Vend."No.");
OnAfterOnModify(Cont, OldCont, Vend);
end;