How to use system events of CodeUnit 1.

How can I use below system events of CodeUnit 1.
• LOCAL [IntegrationEvent] OnAfterOnGlobalInsert(RecRef : RecordRef)
• LOCAL [IntegrationEvent] OnAfterOnDatabaseInsert(RecRef : RecordRef)

Event “OnAfterOnDatabaseModify” works after setting up the “Integration Service” but not for the OnAfterOnDatabaseInsert. So need help to get the correct steps to configure the system events.

Thanks,
Manish Sinha

Best Answer

Answers

  • postsauravpostsaurav Member Posts: 708
    Hi,
    The OnAfterOnGlobalInsert Event documentation in codeunit 1 Says that this event will only fire if Insert happen Via Pages Only.

    Didn't Get Your Question Exactly. Could you please elaborate what exactly you are planning to do?

    Thanks & Regards,
    Saurav Dhyani

    Do you Know this About NAV?


    Connect - Twitter | Facebook | Google + | YouTube

    Follow - Blog | Facebook Page | Google + Page
  • sunmorningindiasunmorningindia Member Posts: 65
    OK Saurav, let me put my word with an example.

    Create a new Codeunit and subscribe event as:
    Event = Subscriber
    EventPublisherObject = Codeunit ApplicationManagement
    EventFunction = OnAfterOnDatabaseInsert or OnAfterOnGlobalInsert

    Inside that function just message some test, the function will similar to:

    LOCAL [EventSubscriber] TestInsertion(RecRef : RecordRef)
    MESSAGE('CU50002-OnAfterOnDatabaseInsert for Table %1 %2.',RecRef.NUMBER,RecRef.NAME);

    Now create a new Customer from Page, but I didn't get the message from subscribed function.
    I am using NAV W1 Build:44365.

    Thanks,
    Manish Sinha
  • postsauravpostsaurav Member Posts: 708
    HI Manish,

    Make Sense - OnAfterOnGlobalInsert doesn't seems to be getting fired.
    There is no much help available as of now.

    But if its related to an upgrade process from NAV 2009 or Before, where old code was placed on OnAfterOnGlobalInsert trigger in codeunit 1, Please move that to OnAfterOnDatabaseInsert.

    That is what MSDN Says, Read it here- https://msdn.microsoft.com/en-us/library/hh167300(v=nav.90).aspx

    Thanks & Regards,
    Saurav Dhyani

    Do you Know this About NAV?


    Connect - Twitter | Facebook | Google + | YouTube

    Follow - Blog | Facebook Page | Google + Page
  • sunmorningindiasunmorningindia Member Posts: 65
    This is a fresh Demo DB with latest build 44365.
  • christianurbanchristianurban Member Posts: 1
    For anyone else who would run into this issue:
    you also need to implement a subscriber function for Publisher "OnAfterGetDatabaseTableTriggerSetup" from Codeunit 1 in which you tell nav for which tableid the events publishers (e.g. OnAfterOnDatabaseInsert) should be executed.
Sign In or Register to comment.