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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Unanswered

Run code After modification or insertion

(0) ShareShare
ReportReport
Posted on by 70

I have created my own custom table in business central.

I have a scenario in which i need to run a code after a record is successfully inserted or modified through a page.

I need to update values to second table depending upon the values after inserted or modified in the page.

There are method such as 

 trigger OnAfterInsert()
trigger OnAfterModify()
But these works on on table extension. I have to perform the same but on my custom table.
How can i achieve this.
( i am using page to insert or modify record).
Not sure which method to use on page or table which executes after insert or modify.
 
  • Daniel Rimmelzwaan Profile Picture
    3,485 on at

    Data related logic should never reside on page objects. Table objects have their own triggers, you are looking for OnInsert and OnModify triggers at the table level. Here's a screenshot of where you put those triggers:

    pastedimage1589417086362v1.png

    I guess if you want to really do something AFTER insert/modify, you could add an event subscriber to a codeunit, and subscribe to the table's events. Create a new codeunit and start the 'teventsub' snippet, that should be self explanatory. There are OnBefore and OnAfter events for both Insert and Modify.

    pastedimage1589417633221v1.png

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 757 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 451 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 391 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans