Announcements
I've created a custom table with 2 fields - One is a lookup to the Customers table, the other is a FlowField that displays the name of the customer selected in first field.
field(18; Customer; Code[20]) { DataClassification = ToBeClassified; Caption = 'Customer No.'; TableRelation = Customer."No."; } field(19; CustomerName; Text[250]) { Caption = 'Customer'; FieldClass = FlowField; CalcFormula = lookup(Customer.Name where("No." = field(Customer))); }
Both fields work correctly, however I'm noticing that if I change the Customer No selected in the first field, the second field doesn't display an updated name until I close and reopen the record.
My question is how can I update the Customer Name field every time the Customer No. is changed, without having to reopen the page? I'm assuming I should utilize the OnModify function but can't quite figure it out.
Thanks!
I have found my issue: I reused the 'Job' object. I have changed this value and everything works well.
Zhu - you continue to come to my rescue, thank you!
Your suggestion fixed this problem, however I am trying to use the same logic for a similar issue and it does not work.
I have created a field on the Job card.
tableextension 50103 AddJobFields extends Job { fields { field(50103; AddressStreet; Text[250]) { DataClassification = ToBeClassified; Caption = 'Street'; } } }
In my new table, I have added 2 fields. The first is a lookup to Jobs, and the second is a textbox that should display the related Jobs 'AddressStreet' field that I created above.
field(2; Job; Code[20]) { DataClassification = CustomerContent; Caption = 'Job'; TableRelation = Job."No."; trigger OnValidate() var Job: Record Job; begin if Job.Get(Job) then AddressStreet := Job.AddressStreet; end; } field(3; AddressStreet; Text[250]) { DataClassification = CustomerContent; Caption = 'Street'; Editable = false; }
I would expect this work, however when I set a value in the Job field, I get the error
The length of the string is 224, but it must be less than or equal to 20 characters. Value: Open Never {00000000-0000-0000-0000-000000000000} Fixed FCY Fixed FCY No No No Per Job No {00000000-0000-0000-0000-000000000000} No 0 0 0 0 No 0 0 0 0 0.
Why would this be happening?
Hi, please don't use flowfield, try the following code.
field(50100; Customer; Code[20]) { DataClassification = CustomerContent; Caption = 'Customer No.'; TableRelation = Customer."No."; trigger OnValidate() var Cust: Record Customer; begin if Cust.Get(Customer) then CustomerName := Cust.Name; end; } field(50101; CustomerName; Text[250]) { DataClassification = CustomerContent; Caption = 'Customer'; Editable = false; }
Hope this will help.
Thanks.
ZHU
André Arnaud de Cal...
294,101
Super User 2025 Season 1
Martin Dráb
232,866
Most Valuable Professional
nmaenpaa
101,158
Moderator