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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to do action after inserted record in sysdatabaselog table

(1) ShareShare
ReportReport
Posted on by 28
Hi All,
 
I want to do some action after record inserted in sysdatabaselog table, and currently i try to use oninserted event handler
 
[DataEventHandler(tableStr(SysDataBaseLog), DataEventType::Inserted)]
public static void SysDataBaseLog_onInserted(Common sender, DataEventArgs e)
{
   //action here
}
 
but the event handler could not be triggered
 
Thanks & Regards,
Masha
I have the same question (0)
  • Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    If it is not triggering, you can write COC on post next or we have postInsert method in the insert of this table where you can use it for writing code. Let me know if this works.
  • it.dev Profile Picture
    28 on at
    Hi Bharani,
     
    I try using this code and still not work
    [ExtensionOf(tableStr(SysDataBaseLog))]
    final class ASP_DatabaseLog_Extension
    {
        public void postInsert()
        {
            ASP_IntegrateLoggingStaging logStg;
    
            next insert();
    
            //Action
        }
    
    }
    Thanks & Regards,
    Masha
  • Suggested answer
    Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at
    Hi @ it dev
     
    In the COC your code should be like this: you should call the insert not  postinsert
     
    [ExtensionOf(tableStr(SysDataBaseLog))]
    final class ASP_DatabaseLog_Extension
    {
        public void insert()
        {
            ASP_IntegrateLoggingStaging logStg;
            next insert(); 
            //Action
        }
    }
     
    Regards,
    Waed Ayyad
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
     
     
  • it.dev Profile Picture
    28 on at
    Hi Ayyad,
     
    still can't trigger the action
    [ExtensionOf(tableStr(SysDataBaseLog))]
    final class DatabaseLog_Extension
    {
        public void insert()
        {
            LogStaging logStg;
    
            next insert();
    
            logStg.clear();
            logStg.FileType = "test";
            logStg.insert();
        }
    
    }
    Thanks & Regards,
    Masha
  • Martin Dráb Profile Picture
    237,970 Most Valuable Professional on at
    I think the records are inserted directly in the database layer, not in the application layer.
  • Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    Can you give some more information your business problem? I understand you need to trigger some action on insert. But if you give more detail, then we can give some other better approach.

    And also in your previous code, you have written COC on postinsert but you called insert. Can you make the next call to postinsert as I suggested in my first response? 
  • André Arnaud de Calavon Profile Picture
    301,134 Super User 2025 Season 2 on at
    Hi Masha,
     
    As Martin mentioned, database log setup will create SQL triggers on the tables. Using these triggers, the database log is filled in the background. Can you tell the business problem you need to solve with an action after the insert?
  • gustavsundblad82 Profile Picture
    2 on at
    As have already been mentioned in this post the logic around databaselog is a bit different so it's not possible to configure alerts or subscribe to events directly off that table as far as I can tell. I have been able to do a workaround for specific scenarios (only parameter tables, heavy risk of performance issues) using signature log. 
     
    SigSignatureLog table works with alerts and thereby you can also leverage the business event for alerts created. The trick is to configure electronic signature on the tables needed, this link explains it very well:
     
     
    Once the signature is set up then you can configure alerts on the signed records and do whatever you need to do with them. For our specific scenarios where we needed to audit specific tables for changes it resolved it without resorting to custom events or anything else.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 456 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans