Monitoring Job Queues: Setting Up Failure Notifications using Power Automate

Introduction

A job queue lets users set up and manage background tasks that run automatically. 
These tasks can be scheduled to run on a recurring schedule.
For a long time, users had a common problem in Business Central—when a job queue failed, there was no alert or warning.
You’d only notice something was wrong when a regular task didn’t run for a few days.
Some people tried to fix this by setting up another job queue to watch and restart failed ones.
But that didn’t always work, especially if an update happened at the same time.

Now, Microsoft has finally added a built-in way to get alerts when a job queue fails. 
You can get notified either inside Business Central or by using Business Events.

In this blog, we'll see the process of leveraging the Business Events to set up notifications on job queue statuses.

References

Configuration

Search for "Assisted Setup" in Business Central's global search.


Scroll down till "Set up Job Queue notifications".


Click on Next.


Add the additional users who need to be notified when the job queue fails along with the job creator (if required).


Choose whether you want the notification to be in-product or using Business Events (and Power Automate).
I'm choosing Business Events this time and then Next.

Click on Finish.

Then search for Job Queue Entries and from that list page open the Job Queue Entry card.


If you are using Power Automate for the first time, then it will ask you for your consent.



As an Administrator, if you want to give the consent for all of the Users at once or revoke the consent for all the Users then you can do so via the Privacy Notice statuses page.


Then, go back to the Job Queue Entry card and click on Power Automate again.
This time, you'll get the option to create an automated flow.


In the pop up screen, you'll get the template for a job queue entry failure notification flow.


Once you click on it, it'll ask you to sign into Business Central as well as the outlook account that'll be used to send the emails (if different from the current user).


In the next screen, you can add additional users that need to be copied on the notifications.


Click on "Create Flow" and you are done!


Ideally, the setup should have worked at this point—but it didn’t.

After some digging, I found out that the Power Automate flow was missing some key pieces. One of the actions didn’t have the environment configured, and another action (GetUrlV3) isn’t even available in the current (v25) version of Business Central. I came across two forum thread (1) (2) about this issue, but they had no clear solution.

So, as a workaround, I created a Web Service based on the Job Queue Entries Log page and used the GetRecord action in Power Automate to fetch the required data.

It wasn’t too hard for me since I knew what to look for; but for a new user, this would’ve been very confusing.

Also, I noticed something odd: the action that picks the email address of the person to notify was pulling it from the Contact Email field on the User Card, instead of using User Setup, which would’ve made more sense.

Anyway, after all that, here’s what the final solution looks like!

Conclusion

Setting up job queue failure alerts with Business Events is a helpful new feature in Business Central.
It lets you know when background tasks fail, so you don’t have to keep checking them manually.

But as we saw, the setup doesn’t always work perfectly.
Some parts were missing, and a few things didn’t make sense like where it pulls the email from.
If you're familiar with Power Automate, you can fix these issues with a few extra steps.
For someone new, though, it might be a bit confusing.

Hopefully, Microsoft will improve the setup in future updates.
Until then, this blog should help you get the alerts working without too much trouble.

Comments

Popular posts from this blog

Event-Driven Architecture: How to Create Custom Business Events in Business Central

Visualizing Data: How to Add Power BI Reports to Business Central

Know Your Users: Automated Usage Tracking for Better System Adoption