Dear community members,
I have (hopefully) a question with a simple answer. I have tried searching for an answer on the web but without success, hence this post.
The question: How do I "inherit" an initial field value set on a Customer Card Extension (or Customer Table Extension) to the same field on a Sales Order Extension?
My scenario:
I have added two fields to the Customer table, the "Freight Payer" field and "Shipping Agent Customer No." field. Please see the code below.
On the Customer Card Extension page, I set the "standard" values for these two fields.
tableextension 50102 "Customer Ext." extends Customer { fields { field(50100; "Freight Payer"; Option) { OptionMembers = "Sender", "Receiver"; } field(50101; "Shipping Agent Customer No."; TEXT[20]) { TableRelation = "Shipping Agent Cust. No. Table"."Shipping Agent Customer No." where("Customer No." = field("No."), "Shipping Agent Code" = field("Shipping Agent Code")); ValidateTableRelation = false; } } }
On my Sales Order table extension, I have added the same fields.
What I want to do is that when I create a new sales order for the customer, the initial values set in the Customer table extension will be "transferred"/"inherited"
to the Sales Order. InitValue does not seem to work as when I type "Customer", no reference to the "Customer" table extension pops up.
See code below.
tableextension 50101 "Sales Order Table Ext." extends "Sales Header" { fields { field(50100; "Freight Payer"; Option) { OptionMembers = "Sender", "Receiver"; InitValue = //Get standard/initial value set in the Customer table extension. } field(50101; "Shipping Agent Customer No."; TEXT[20]) { TableRelation = "Shipping Agent Cust. No. Table"."Shipping Agent Customer No." where("Customer No." = field("Sell-to Customer No."), "Shipping Agent Code" = field("Shipping Agent Code")); ValidateTableRelation = false; InitValue = //Get standard/initial value set in the Customer table extension. } } }