I have created a 2 new custom fields in customer table you can see the below screenshot
I have also created the same fields in the sales header, now when I create a sales order with the above customer, I want to flow the data of those 2 fields to the sales order. Can you guys please help me with this?
Hello,
You don't mention which version, but as you say that you are adding fields to an existing table, I take that this is BC14 or earler, OnPrem. If you need this for SaaS, then we need to work with extensions, and then the answer would be a bit different, but the same principle really.
NAV / Business Central is trigger driven. Wherever possible, use Table Triggers and then your business logic will apply no matter from where you call it (from any page, from code, from Web Services, etc). So what you want here, is on table 36 "Sales Header" - trigger "Sell-to Customer No. - OnValidate()". Look for this line:
GetCust("Sell-to Customer No.");
After this you can assign from the Cust variable to your Sales order record, like this:
"Customer Text" := Cust."Customer Text";
"Customer Option" := Cust."Customer Option";
I think this should do. It does require a develoeprs license to access triggers. If you don't have that, there is also the option to add the fields as FlowFields, so they are calculated fields on the Sales Order, that look up the values in the Customer Table, like this:
Field properties:
FieldClass = Flowfield
CalcFormula = Lookup(Customer."Customer Text" WHERE (No.=FIELD(Sell-to Customer No.)))
I hope this helps.
Sohail Ahmed
932
YUN ZHU
841
Super User 2025 Season 1
Mansi Soni
602