tableextension 60100 CustomerParts extends Item
{
fields
{
field(60100; /Customer Name/; Text[200])
{
Caption = 'Customer Name';
FieldClass = FlowField;
CalcFormula = lookup(Customer.Name where(/No./ = field(CustomerNo)));
}
field(60101; CustomerNo; code[20])
{
Caption = 'Customer No';
TableRelation = Customer;
trigger OnValidate()
begin
CalcFields(/Customer Name/);
end;
}
}
local procedure CopyFields()
var
dt: DataTransfer;
dest: Record /Sales Line/;
src: Record Item;
begin
dt.SetTables(Database::Item, Database::/Sales Line/);
dt.AddFieldValue(src.FieldNo(CustomerNo), dest.FieldNo(CustomerNo));
dt.AddSourceFilter(src.FieldNo(CustomerNo), '=%1', 'A');
dt.CopyFields();
end;
}