Update a field when a value in another field is validated
MelekBoujelbene
Member Posts: 17
Hello,
Why the following code is not updating the value of "No. Contrat" when a new value of "Code Client" is seleted (this code is in a Card page)
Why the following code is not updating the value of "No. Contrat" when a new value of "Code Client" is seleted (this code is in a Card page)
field("Code Client"; "Code Client")
{
CaptionML = FRB = 'Code client';
trigger OnValidate();
var
locContrat : Record Contrat;
locContratDetail : Record "Contrat Detail";
begin
locContrat.Reset;
locContrat.SetRange("Code Client","Code Client");
locContrat.SetCurrentKey("No.");
if locContrat.FindLast
then Validate("No. Contrat",locContrat."No.");
Message ('%1 : Contrat No = %2',locContrat.FindLast,locContrat."No."); // show "YES" and the correct value of "No. Contrat"
CurrPage.Update(true);
end;
}
0
Best Answer
Answers
-
Hello!
try to move code to onValidate trigger in table1 -
Hello AlexeyShamin,
Thank you for your quick reply.
It didn't change anything.
(sorry i didn't know your answer will be colored in red
)
0 -
ok. try to change
Validate("No. Contrat",locContrat."No."); --> "No. Contrat" := locContrat."No.";
If it will be ok - error in inValidate trigger on field "No. Contrat"0 -
Unfortunately that gave the same result
0 -
locContrat.modify; missing1
-
-
Add before message line:
Message ('%1',"No. Contrat");
Or use Debuger to evaluate value of Rec."No. Contrat" after VALIDATE
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 326 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions