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 :
Small and medium business | Business Central, N...
Suggested Answer

Code architecture for a simple copy data routine

(0) ShareShare
ReportReport
Posted on by 9
Dear Community,
 
I came from a different programming language and I am new to AL.
 
For an interface between BC and a MES System I want to catch all changes on the Production Order Line Table and copy these changes to a separate table. Later, I want to make them accessible via REST.
 
I am wondering which of the following architectures would be the most AL typic approach:
 
Solution one:
1. Writing a Codeunit that does the Copy Job i. e. transferring data from production order line table to the new table
2. Calling these Codeunit from the OnInsert, OnModify, etc. Triggers at the production order line Table.
 
Solution two:
1. Writing a Codeunit that does the Copy Job i. e. transferring data from production order line table to the new table
2. Extending this Codeunit with an EventSubscriber that is listening on Prod. Order Line Table.
 
I appreciate your help!
I have the same question (0)
  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,111 Moderator on at
    For this I do not think that i would use any of the approaches that you suggest.
     
    On all the tables in Business Central there are a system created at (datetime) and sysstem modified at (datetime) field. 
    So I think the best approach would be to make a codeunit that could run in a jobscheduler that copied the needed data to a separate table on a schedule f.ex. once every hour or so.
     
    You could also publish the table directly and let the recieving system keep track of what is the last datatime they have handeled modifications from and let them filter on that in their query.
     
    Then you would not have to duplicate any data at all.
  • CaseTree Profile Picture
    9 on at
    Thank you for your response. I checked the tables. However, I could not found the mentioned fields. I guess these tables (e. g. production order line) do not have these fields, do they?
     
    Notwithstanding your suggestion, would be solution one or two more al like?
     
    Thank you for help!
     
    Best regards

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,135

#2
YUN ZHU Profile Picture

YUN ZHU 733 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 612

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans