Problem description
Alert is not generated, although Alert rule is enabled.
Steps
1. Create a new alert rule for Customers insert event
Accounts receivable > All customers > select Customer account field and right click > Create alert rule...
2. Add Customers table to Database log using a standard wizard
System administration > Setup > Database > Database log setup > New > Next > Open General ledger and select Customers
3. Create a new customer
4. Run Change based alerts job
System administration > Periodic > Alerts > Change based alerts
5. No alert is generated
Below you will find hints and solution description, however challenge yourself and try to repeat described steps and make assumptions :-)
Hints
Compare data in
DatabaseLog
table for CustTable
before and after step 2.Solution
Alert rule framework also uses
DatabaseLog
table to store setup.When a new alert rule is created for a table - a record is inserted into
DatabaseLog
table (logType
is equal to EventDelete
or EventInsert
or EventRenameKey
or EventUpdate
).When a table is added to Database log using standard AX wizard all previously created database log setup records for the table are deleted and new records are created. It is done in
\Classes\SysDatabaseLogWizard\doRun
methodwhile select forupdate dblog { if (SysDatabaseLogWizard::tableAllowed(dblog.LogTable)) { dblog.delete(); } }Alert rule is still available, however as Database log setup is lost, no alert is generated.
Exclude records with
logType
equal to EventDelete
, EventInsert
, EventRenameKey
and EventUpdate
to keep Alert rule setupwhile select forupdate dblog where dblog.logType != DatabaseLogType::EventDelete && dblog.logType != DatabaseLogType::EventInsert && dblog.logType != DatabaseLogType::EventRenameKey && dblog.logType != DatabaseLogType::EventUpdate { if (SysDatabaseLogWizard::tableAllowed(dblog.LogTable)) { dblog.delete(); } }
Very nice, thank you.
ReplyDeleteHi Oleg,
ReplyDeleteI did notice this DataBase table entries some time ago.
Then I accidentally deleted all of them when I was deleting regurar logs.
What is wired, it looks like alerts are still working good. I even made a test on the new insert rule. Alert works fine with DataBase entry and still work when I delete it.
Did you have any more experience on that?
Hi Frayday, did you delete all records in DatabaseLog table?
Delete