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.
Comments
Or use Event if 2016/2017
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