I've created a table and a page for my custom field and I've extended the Customer table and Sales Header.
Basically, I want to create a new field in the customer table, card, and list. This field needs to appear also in the Sales Invoice under the customer's name.
The idea here is that if I change the field value in the Sales Invoice page, the value is automatically changed in Customer. In order to achieve that, I need to use Events. This is where it gets tough for me, the field needs to be editable so it can't be of class FlowField. However, the value cannot be fetched from Customer if the field isn't Flowfield (through CalcForm).
I'm completely lost as to how to link the field and make it editable. (Note: I'm using AL to write my code.) How do I solve this issue?
table 50140 "EORI Table"
{
DataClassification = ToBeClassified;
fields
{
field(1; Customer_No; Code[20])
{
DataClassification = ToBeClassified;
}
field(2; EORI; Text[50])
{
DataClassification = ToBeClassified;
Editable = true;
}
}
keys
{
key(PK; Customer_No)
{
Clustered = true;
}
}
}
page 50121 "EORI Card"
{
PageType = Card;
ApplicationArea = All;
UsageCategory = Administration;
SourceTable = "EORI Table";
layout
{
area(Content)
{
group(GroupName)
{
field("Customer No."; Customer_No)
{
ApplicationArea = All;
}
field(EORI; EORI)
{
ApplicationArea = All;
Editable = true;
}
}
}
}
actions
{
area(Processing)
{
action(ActionName)
{
ApplicationArea = All;
trigger OnAction()
begin
end;
}
}
}
var
myInt: Integer;
}
page 50122 "EORI List"
{
PageType = List;
ApplicationArea = All;
UsageCategory = Lists;
SourceTable = "EORI Table";
CardPageId = "EORI Card";
layout
{
area(Content)
{
repeater(GroupName)
{
field("Customer No."; Customer_No)
{
ApplicationArea = All;
}
field(EORI; EORI)
{
ApplicationArea = All;
Editable = true;
}
}
}
}
actions
{
area(Processing)
{
action(ActionName)
{
ApplicationArea = All;
trigger OnAction()
begin
end;
}
}
}
var
myInt: Integer;
}
tableextension 50123 EORITableExt extends Customer
{
fields
{
field(50123; EORI; Text[50])
{
TableRelation = "EORI Table".EORI;
ValidateTableRelation = true;
Editable = true;
}
}
}
pageextension 50125 EORIPageCardExt extends "Customer Card"
{
layout
{
addafter(Name)
{
field("EORI No."; EORI)
{
ApplicationArea = All;
Editable = true;
Lookup = true;
}
}
}
actions
{
addafter(Prices)
{
action(EORI)
{
ApplicationArea = All;
RunObject = page "EORI List";
}
}
}
}
pageextension 50126 EORIPageListExt extends "Customer List"
{
layout
{
addafter("No.")
{
field("EORI No."; EORI)
{
Editable = true;
}
}
}
actions
{
addafter(ApprovalEntries)
{
action(EORI)
{
RunObject = page "EORI List";
RunPageLink = "Customer_No" = field("No.");
}
}
}
}