Hi,
This test is done in Std Cronus, NAV2018 11.0.26893 .
1) In Codeunit1, function OnDatabaseModify, I put a breakpoint here.
2) Then I turn on the debugger
3) When I modify a record SalesLine table (Modified from table directly, not from Page), the debugger breaks on the OnDatabaseModify function
GREAT!!!
4) However when I modify a record in PurchseLine table (Modified from table directly, not from Page), the debugger DOES NOT break on the OnDatabaseModify function
NOT GREAT!!!
Why is it that changes in PurchaseLine table does not trigger OnDatabaseModify trigger?
I have also tested with other table such as Customer, Payment Terms, currency, and these tables fire the OnDatabaseModify function. But this does not seem to work on PurchaseLine.
Jordi
0
Comments
Try to close the debugger and development environment, open it again and re-do your test.
The OnDatabaseModify trigger should run whenever there is a change to any record.
However, there is a workaround. Turn on change log for PurchLine table, and the OnDatabaseModify trigger will fire.
It'll fire but you validated that it didn't just fire because of the Change Log record?
This function will ONLY run once per session when the table is first accessed. So once you have the code in place that calls the function "GetDatabaseTableTriggerSetup", you need to restart your client.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
@kriki is right. I was wrong, the OnDatabaseModify trigger does not run in every single record, it only runs on the ones that are defined like @kriki said.
I suggest you to read this article, and focus on deV.ch's answer: https://forum.mibuso.com/discussion/59929/cu-1-ondatabase-methods
This the solution. You either modify this function to include the table you want to fire Database triggers, or just simple enable it in changelog.
Thanks.