Skip to main content

Notifications

Announcements

No record found.

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
    RE: Run code After modification or insertion

    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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans