Hi Guys,
I have made a new table extension and added a new field Ship to External No:
However what i want to do now is to get the value of 2 existing fields and combine them as the value of the new table.
For example the current values of the fields are:
Thus the value of the new field "Ship To External No" must reflect "01121212-002"
How can one achieve this?
Thanks
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;
André Arnaud de Cal...
291,979
Super User 2025 Season 1
Martin Dráb
230,848
Most Valuable Professional
nmaenpaa
101,156