web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Job Queue Entries error notification in business central

(1) ShareShare
ReportReport
Posted on by 85

When we have  status an error in Job Queue Entries send mail to notify me in the business central

I have the same question (0)
  • Suggested answer
    Vaishnavi J Profile Picture
    3,096 on at

    Hi

    You can customize below is the logic which you can use it

    codeunit 50020 SendNotifification
    {
        trigger OnRun()
        var
           
            JobQueue: Record "Job Queue Entry";
            GetJobQueueDetails: Text[2048];
        begin
            Clear(JobQueue);
            JobQueue.Reset();
            JobQueue.SetRange("Object Type to Run", JobQueue."Object Type to Run"::Codeunit);
            JobQueue.SetFilter("Object ID to Run", '50003..50020');
            JobQueue.SetRange(Status, JobQueue.Status::Error);
            if JobQueue.FindSet() then
                repeat
                    GetJobQueueDetails += Format(JobQueue."Object ID to Run") + ' ' + JobQueue."Object Caption to Run";
                until JobQueue.Next() = 0;

            if GetJobQueueDetails <> '' then begin
                SentMails(JobQueue, GetJobQueueDetails)
            end;
        end;


        local procedure SentMails(var JobQueue: Record "Job Queue Entry"; var Details: Text[2048])
        var
            Rec_UserSetup: Record "User Setup";
            MailingList: List of [Text];
            CU_Email: Codeunit Email;
            CU_EmailMessage: Codeunit "Email Message";
            SubjectLbl: Label 'Job Queue Failed in Business Central';
            BodyLblDeptHod: Label 'Hi IT Team, <br> <br> This is to inform you in Business Central some of the job queue failed. <br> Kindly view the failed job queue %1 this by visiting <a href="%2"> </a> here.';
            AppLink: Text;

        begin
            Clear(AppLink);
            Clear(Rec_UserSetup);
            Rec_UserSetup.Reset();

            Rec_UserSetup.SetRange("IT Department", true);
            if Rec_UserSetup.FindSet() then
                repeat
                    if Rec_UserSetup."E-Mail" <> '' then
                        MailingList.Add(Rec_UserSetup."E-Mail");
                until Rec_UserSetup.Next() = 0;
            AppLink := GetUrl(ClientType::Web, CompanyName, ObjectType::Page, Page::"Job Queue Entries", JobQueue, true);

            if MailingList.Count <> 0 then begin
                Clear(CU_EmailMessage);
                CU_EmailMessage.Create(MailingList,
                                        StrSubstNo(SubjectLbl),
                                        StrSubstNo(BodyLblDeptHod, Details, AppLink), true);

                CU_Email.Send(CU_EmailMessage);
            end;
        end;



    }
    If my answer was helpful to you, please verify it so that other users know it worked. Thank you very much.
  • Suggested answer
    KasparsSemjonovs Profile Picture
    4,842 Super User 2026 Season 1 on at

    You should be able to use "Field monitoring" functionality, to monitor the Job Queue status, and send You notification when it changes to Error.

  • CU27040856-14 Profile Picture
    2 on at
    What happens if an error occurs when sending an email?
  • ManishS Profile Picture
    86 on at
    As suggested by @KasparsSemjonovs this is a great method, this is mainly used for audit purpose, but you can also use it to monitor of status.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 694 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 481 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 328 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans