I have a problem when I try to enter a value in a form. What I want is to modify the General Journal form. At the moment when I enter a value at Applies-to Doc. No. , I want the External Document No. to be filled automatically with the same value that I entered in the Applies-to Doc. No. field. I tried entering this code in the Applies-to Doc. No. OnValidate trigger of Gen. Journal Line table
VALIDATE(“External Document No.”,“Applies-to Doc. No.”); but it did not work. I wrote half an hour earlier but I forgot to specify exactly where I have written the code. Can anyone help me, please?
Are you sure your code is being called? Try to trace it through the debugger. A lot of times there will be code in place in the OnLookup trigger for a field. This code will fill in the field using a :=, but will not Validate it. I don’t know if that is the case here, but the debugger should be very helpful.
Is the code that I have written the right one? Except the code that I wrote in Applies-to Doc. No.-OnValidate **Validate(“External Document No.”,“Applies-to Doc. No.”)**at the end of the existing code in the Gen Journal Line table, also wrote Validate(“External Document No.”,“Applies-to Doc. No.”) in the OnValidate trigger of the textbox Applies-to Doc. No.
Following Max’s advice you will find that the OnValidate-trigger of the Applied-to-Doc No. field will not be called. This is due to the fact that, once code is written in the Onlookup-trigger, NAV also requires you to explicitly call the OnValidate trigger for this field. In your case: you have only modified the OnValidate trigger of the Applied-to-Doc No. field. But you should also modify the OnLookup trigger with your code.
BTW: you can check your code the following way also. Do not use the lookup om the Applied-to-Doc No. field, but enter the value manually (i.e. by typing. This way the OnValidate trigger will be executed and so your code also.
To saju.k
Sorry to say saju.k, but it seems your talking another language. It doesn’t make sense to me in this context
Forums » Navision Forums / Microsoft Dynamics NAV Forums » Dynamics NAV / Navision - Developers Forum » How should I enter a value in a field automatically when I fill another field in the same form