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!
0
Answers
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.