Every company has some kind of repetitive process that needs to be run every day, week or so. For that, Business Central provides the Job Queue Entries which has been around for a long time.
In this post we will see how to build a codeunit to keep your custom processes and then setup a job queue to be run automatically.
Job Queue Example
If we want to run a process via codeunit we need to specify the codeunit number. And you would think that for every process you need to create a codeunit and a job entry to call it.
While you have to create a job entry to schedule every process there is a way to call all your processes in one codeunit and then tell the job entry to run the same codeunit.
That way you can have all processes in one place and you will only need to call one codeunit.
The key word here is ‘Parameter String’. It is really easy to use, let me show you how it is done.
First, you need to create a codeunit wich ‘TableNo’ property is “Job Queue Entry”. Now the source table will be our desired table.
Then, the code will be in the OnRun trigger and we will use a “case” to select wich Parameter String identify our process.
Finally, once we have our codeunit ready we just need to create the job entries and setup the Parameter String field accordingly.
Hope you find it useful.