web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

In which codeunit i can write code when any insert / Modify for in NAV tables ?

(0) ShareShare
ReportReport
Posted on by 989

Hi expert ,

   Can any one give me any document from which i can know that which tables are used which codeunit ? I want to write my code for main tain a update flag for (Items / Customer / Shipping Address / Sales  Price / Sales line Discount ) tables which  will be Inserted / Updated?

Thanks in Advance

Surajit

*This post is locked for comments

I have the same question (0)
  • Benoit Delvaux Profile Picture
    870 on at

    Hi,

    If the purpose is to have a log of insertions, deletions & modifications you can easily set it up from the Change Log Setup page.

    Hope it helps...

  • surajitkundu Profile Picture
    989 on at

    Hi Benoit ,

     Thanks for the reply . Actually I have maintain a udf column ('UpdateFlag') for those above tables . I want to update this flag by 'F' value when data are inserted /Updated in above those tables . I have write code for example of item table :

                                   Item.GET("Item No.");

                                   Item.UpdateFlag := 'F';

                                   Item.MODIFY;

       But I can't understand where the above code is placed for the above those tables.Have you any document where I can see which tables(Items / Customer / Shipping Address / Sales  Price / Sales line Discount )  use codeunit  for Insert/Update ?

    Thanks

    Surajit

  • surajitkundu Profile Picture
    989 on at

    Hi expert ,

     Please give me a suggestion .

    thanks

    Surajit

  • Benoit Delvaux Profile Picture
    870 on at

    So you want to log values un a third-party table each time data is Inserted / Modified in a NAV table like Item, Customers, Shipping addresses etc?

    Then you just need to put your code in the OnInsert / OnModify trigger of each Table.

    Each table in NAV has OnModify/OnInsert/OnDelete trigger.

    If you want to log for a specific field then you need to put your code in the OnValidate trigger of that field.

    If you want to create kind of more generic logging system then you can analyze the CodeUnit 1 ApplicationManagement which contains more global triggers like OnDatabaseInsert for example which is fired each time something is inserted regardless of the table. (but be careful as it is a core codeuinit of Nav and each change should be thouroughly analyzed)

    Regards,

  • Andri Wianto Profile Picture
    385 on at

    Run the Debugger, and see what you are looking for. All of them you are looking for is there.

  • Suggested answer
    Mohana Yadav Profile Picture
    60,997 Super User 2025 Season 2 on at

    You need to use Object Manager tool of Idyn.

    Google it.you will find more info.

  • Suggested answer
    Jens Glathe Profile Picture
    6,092 on at

    Hi Surajit,

    in addition to the answers already given (especially Ben's), please be aware that there is a major difference what the cause of the modification is. If anything is entererd by GUI and the normal table triggers are used, then you have several options, where putting the code into the OnInsert/OnModify/OnDelete trigger of the table might be feasible. However, when the changes are done by code (running an update batch, an xmlport without using modify(true), various other possible sources), then you have only one trigger inside NAV: The OnDatabaseInsert/Modify/Delete functions in CU 1. But as Ben said, be careful, this can have a major impact on performance.

    with best regards

    Jens

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans