Lock Table & Job Queue

ktwoone
Member Posts: 4
Hi All,
I have a job (Job1) that runs every minute in a Job Queue which posts journal entries. There is another job (Job2) that runs at the end of the day which locks the ledger table. When that happens Job Queue for Job1 crashes and the Job Queue Status gets updated to Error.
I'd like Job1 to run only if it the ledger table is not locked by another process. LOCKTABLE does not have return value for me to use a guarded IF. Try Function does not accept LOCKTABLE. Can someone recommend a workaround?
Appreciate any help.
Thanks!
I have a job (Job1) that runs every minute in a Job Queue which posts journal entries. There is another job (Job2) that runs at the end of the day which locks the ledger table. When that happens Job Queue for Job1 crashes and the Job Queue Status gets updated to Error.
I'd like Job1 to run only if it the ledger table is not locked by another process. LOCKTABLE does not have return value for me to use a guarded IF. Try Function does not accept LOCKTABLE. Can someone recommend a workaround?
Appreciate any help.
Thanks!
0
Answers
-
If you assign both Job Queue Entries to the same Job Queue Category, then they will not execute at the same time and you won't need to worry about one locking records required by the other.1
-
Thank you for replying @ShaiHulud. Unfortunately, that is not an option. I need a way to identify whether the specific table is locked. And if Yes, then don't execute my job.0
-
Thank you for replying @ShaiHulud. Unfortunately, that is not an option. I need a way to identify whether the specific table is locked. And if Yes, then don't execute my job.
You can implement a retry mechanism for the jobs and use it only on the job you want. Otherwise you will have to use a SQL query from within NAV to check it the table is locked and act based on the results. There are various SQL queries to do so, being a classic you can use an ADO connection and good luck
But to be honest, @ShaiHulud 's solution is the easiest and the results are the same: job1 won't be executed unless job2 has finished.
1
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions