Run CodeUnit when new record inserted on a Page

HGM
HGM Member Posts: 2
How do you setup/code OnNewRecord trigger on a page to run a codeunit? Thanks.

Comments

  • Juhl
    Juhl Member Posts: 724
    Well you run it from the trigger!!!
    Or use Event if 2016/2017
    Follow me on my blog juhl.blog
  • HGM
    HGM Member Posts: 2
    I'm new to NAV coding that's why I want to know how to setup the trigger.
  • aceX
    aceX Member Posts: 166
    When you insert into a "page" you actually are inserting record in a table :). Put the code which call the needed codeunit on Insert trigger in the table which is used by your page.
    Page is not the object in where you should insert a code, except when you must to do it in the page...

    You need to create global variable from type Codeunit in that table and just call the codeunit.

    Regards