how to add a new row and input value with codeunit on form

redriver_liuredriver_liu Member Posts: 4
hi All,

I am a freshman for Navision, I want to add new row and input value with codeunit on General Journal form automatically, meanwhile I want to use the existing trigger to get some value like account name when I input account No. with codeunit, how can I do it? could you please give some advice, I will appreciate so much if you can give me some example codes.

thanks!

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    You can search codeunit 80/90 to with GenJnlLine.INIT;

    You will get some idea..
  • redriver_liuredriver_liu Member Posts: 4
    Thanks mohana_cse06 !

    I know the way that you said, INIT and INSERT, but this way only can use trigger of table, can not use trigger of Form.
    How can I use the trigger which is on Form, not on table? like this:

    //this code is in General Journal Form
    Account No. - OnValidate()
    GenJnlManagement.GetAccounts(Rec,AccName,BalAccName);
    ShowShortcutDimCode(ShortcutDimCode);

    Thanks!
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    I know the way that you said, INIT and INSERT, but this way only can use trigger of table, can not use trigger of Form.

    What do you mean by this? which cant be used in form?
    why do you want to do in forms?
  • redriver_liuredriver_liu Member Posts: 4
    Actually, I want to simulate the user input process with propram like this:

    The General Journal Form was opened Auto. and then the cursor will be put in Posting date column, and then input data in this column, switch to next column, input value, but there are some column will get value Auto. when some special column was inputted value (like when Account No. was inputted value, the Description will get value Auto. etc...). all those things are done by program. that is what I want.

    Anyway, thank you!
  • DenSterDenSter Member Posts: 8,305
    How can I use the trigger which is on Form, not on table?
    You shouldn't do this type of thing on the form to begin with, especially not in field validation. Validation code like that belongs in the table, not on the form.
Sign In or Register to comment.