Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Running code on every insert

Posted on by Microsoft Employee

Hi!

I would like to run some code on every new record of a table.

The INSERT trigger don't manage it because the lines are inserted by codeunits that do not run the trigger and I have no permisions to change them (Item Journal...).

Is there a way to do that?

In detail, I need to update a field on a table (50xxx) on every change of the item inventory. I thought to put the code on the INSERT trigger of the Item Ledger Entry, but how to run the trigger?

Waiting your thoughts!

Thanks in advance.

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Running code on every insert

    Thanks!!

    This solved my problem Amol Salvi ;) Your "trick" did it!

    The resource suggested by  Mirko Markovic would be fantastic but it seems to work only after Nav2015 :(

    Thanks again!!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Running code on every insert

    Thanks Mirko Markovic!

    It would be great but it is NAV2015 :(

    Is there any other workaround to the the same here?

    The solution of Amol Salvi works here but not on every tables, so it would be good to know if we can do this on NAV2015...

    Thanks once again.

  • RE: Running code on every insert

    If working in NAV2016 or NAV2017  the best way is to use subscriber on Item Ledger Entry Modify and Insert trigger.

  • Verified answer
    Amol Salvi Profile Picture
    Amol Salvi 18,694 on at
    RE: Running code on every insert

    Maybe after posting of record you can modify the record . You need to write code in Codeunit No 21

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans