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

Event subscriber not working

(0) ShareShare
ReportReport
Posted on by 259

Hi, I am subscribing an event of codeunit 449 -  Job Queue Start Codeunit. But I am not getting my required result. for example inset a record in custom table.

Here is my code

EventSubscriberInstance = StaticAutomatic;

    [EventSubscriber(ObjectType::Codeunit449'OnAfterRun''', true, true)]
    procedure abd(JobQueueEntry: Record "Job Queue Entry")
    begin
        Message(StrSubstNo('%1', JobQueueEntry.Status));
    end;
I have the same question (0)
  • Bilal Haider Profile Picture
    414 on at

    Hi Danyal,

    What do you mean by insert a record in custom table? and what is its relation to Job Queue Start codeunit's event OnAfterRun.

    Please add more detail to it.

    Regards,

    Bilal Haider

  • Danyal Profile Picture
    259 on at

    Inserting record in a custom table was just an example, this can be anything, for example generating emails etc.

    So I want to generate an email or create custom logs whenever a job goes to error. Can I use the event which I mentioned? or is there any other way?

  • Suggested answer
    Bilal Haider Profile Picture
    414 on at

    The event that you have mentioned in example code will run after a JobQueue is started. I do not know your exact requirements but I think you need to subscribe an event when an entry is created in Job Queue Log Entry table. If that is the case then use event like OnAfterInsert or there are many other events available for Job Queue Log Entry table. One potential event that you can use is OnBeforeMarkAsError.

    Hopefully this will help you.

    Regards,

    Bilal Haider

  • Danyal Profile Picture
    259 on at

    I have tried onAfterInsert and OnAfterValidate, onAfterModify but seems these triggers are not getting any hit.

    Just tried onBeforMarkAsError, but nothing happened

  • Suggested answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,284 Super User 2025 Season 2 on at

    The job queue runs in the background, so you will not get any message pop-up.

    If you want to capture the error log, you need to subscribe to the right event.

    Check codeunit 450 "Job Queue Error Handler".

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,606

#2
YUN ZHU Profile Picture

YUN ZHU 931 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans