ArcherPoint Dynamics NAV / Business Central Developer Digest - Vol 329
This week’s Developer Digest features two Developer Tips of the Day—Changes to the Job Queue and using the Date variable with fields.
The Dynamics NAV and Business Central community, including the ArcherPoint technical staff, is made up of developers, project managers, and consultants who are constantly communicating, with the common goal of sharing helpful information with one another to help customers be more successful.
As they run into issues and questions, find the answers, and make new discoveries, they post them on blogs, forums, social media...so everyone can benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this community—so we thought, wouldn’t it be great to share this great information with everyone who might not have the time to check out the multitude of resources out there? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from NAV/BC experts and devotees around the world. We hope these insights will benefit you, too.
Developer Tip of the Day: Job Queue
Kyle shares another one of his infamous developer tips: “I'm sure you have heard that Microsoft reworked the Job Queue such that it uses the underlying Scheduled Task engine (Task Scheduler) to make everything work. And they did a pretty good job of making that seamless to the user. Seamless to the developer? Not so much.
Job Queue doesn't actually do anything. Everything becomes a Scheduled Task, which is system table 2000000175. This has several implications.
First, it cares a whole lot more about the user ID of the last person that touched the Job Queue Entry. This is good for things like background posting Sales Orders or scheduling a one-off report, but it’s not good at all for recurring jobs. You want those to run under the normal NST service account. There is a service tier setting that (sort of) allows this, and by sort of, I mean that if you do not disable this setting, a job queue entry will fail if the user isn't the one it expects it to be:
The task cannot be updated because the user account that is assigned to run the task has been altered. The modification has been canceled.
Set this in the customsettings.config file:
<add key="EnableUserConsistencyValidationOnTasks" value="false">
Second, there is no longer a Run Now ability. You used to be able to set the Earliest Start DateTime to T (today at midnight), and any Ready Job Queue Entry would start executing. Not any longer. You can only edit a JQE with a status of On Hold. And if you do On Hold, set the Earliest DateTime, and then back to Ready, changing the status does a new scheduled time based on the recurrence rules, overwriting your ‘go now’ datetime.
Third, there isn't a way to set the correct UserID for job queue entries so that it runs under the NST account.
Code is required to fix these issues.”
Developer Tip of the Day: Disabling or Making Fields Uneditable Using a Page Variable
Kyle shares another developer tip of the day: “Using a Page variable to disable fields or make them uneditable—you have to tell the page to include that variable in the data set, or it won't work correctly. Here’s how:
Just for Fun
The H in "Software Development" stands for Happiness.
If you are interested in Dynamics NAV and Business Central development, be sure to see our collection of NAV/BC Development Blogs.
Read the "How To" blogs from ArcherPoint for practical advice on using Microsoft Dynamics NAV and Dynamics 365 Business Central.