Dynamics NAV / Business Central Developer Digest - Vol 354

Dynamics NAV / Business Central Developer Digest - Vol 354

Correcting an errant Job Queue, finding a SQL query, and a developer tip of the day for Job Queue are all in this edition of Developer Digest.

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.

Job Queue Not Running and How to Correct It

Elizabeth asks: “Hello Developer Gang! I have received a solution from Microsoft and want to see if anybody has done this yet. I'm looking for feedback, forewarning of any adverse effects, how long this would take, and most of all a taker.”

Abridged backstory: 

  • Job Queue on a BC 16 On-Prem hasn't run since 01/01/21 for any of their recurring jobs. 
  • Went to restart the NAS and found that Task Scheduler wasn't enabled. I enabled it and restarted the NAS instance.  
  • Per the Job Queue Entries Log, the jobs ran that one time and never again.  
  • Submitted ticket to Microsoft. 

Microsoft Response: 

Troubleshoot Recommendation: 

  • Run Get-NavTenant -ServerInstance  and see which State their tenant is in.
  • If it is in OperationDataUpgradePending, they should run the upgrade.

Outcome: 

State = OperationDataUpgradePending 

Solution: 

start-navdataupgrade -tenant default -serverinstance  -SkipUserSessionCheck 

After this, the tasks scheduled with the Job Queue should run as expected. 

Please let me know if anybody has done this before. Your feedback and help are greatly appreciated.”

Determining Where a SQL Query is Running (Dynamics NAV 2018)

Faithie calls out: "Hello Cool Developers! I'm trying to determine where the attached SQL Query is running from in NAV (2018). I've checked for a FINDFIRST with the three key fields and found it in 2 places without a key. So, I created a key, added it to the code, and I'm still getting the same locks. Any ideas on how I can find where else this is coming from? I can tell you it always happens on packing stations - so shipping - posting shipment - posting invoices - all are places I've searched."

Matt T replies: "EXISTS is translation for ISEMPTY"

Faithie replies to Matt: “Cool! I can search to Salesline.ISEMPTY. I'll do that.”

Developer Tip of the Day: Job Queue Run Now 

Kyle shares another Developer Tip of the Day: “When Job Queue was reworked recently (I think BC16), Microsoft redid how the task scheduler engine works. Now, the table Job Queue Entry is just a facade; the real table is a new, special system table called Scheduled Task. Another thing they changed (that sucks) is that if a user changes the status of a job queue entry (Ready, On Hold), that user now owns that job queue entry, and so the task scheduler will attempt to run that job under that person's user account. Not cool. I can't think of a reason why anyone would want to do that - at least not for recurring jobs. 

I've attached two AL files that address both of these issues. The Job Queue Entry Page has two added functions, called Set Job Queue User ID and Run Now. The first pulls the account to use from a setup table. We use the service account the Task Scheduler service tier is running under. Tip of the hat to Todd Tipton for figuring out the Ser Job Queue User ID piece. OnPrem only. Probably.”

Trending Posts

Stay Informed

Choose Your Preferences
First Name
*required
Last Name
*required
Email
*required
Subscription Options
Your Privacy is Guaranteed