RE: Combining the values of 2 fields into one new column
Hi,
You should call those events for your table in the codeunit or you can write the below code On OnInsert trigger and OnModify Trigger as well.
[EventSubscriber(ObjectType::Table, database::"YourTable", 'OnAfterInsertEvent', '', true, true)]
local procedure OnAfterInsertEvent_YourTable(var Rec: Record "YourTable")
begin
if (rec."Customer No." <> '') and (rec.code <> '') then
rec."External Document No." := rec."Customer No." + ' ' + rec.Code;
end;
[EventSubscriber(ObjectType::Table, database::"YourTable", 'OnAfterModifyEvent', '', true, true)]
local procedure OnAfterModifyEvent_YourTable(var Rec: Record "YourTable")
begin
if (rec."Customer No." <> '') and (rec.code <> '') then
rec."External Document No." := rec."Customer No." + ' ' + rec.Code;
end;