Scheduler

In this article

To run Scheduler in LS Central on the Task Scheduler

Setting up the Scheduler Service in the Job Queue Entry card

Job Queue Entry Parameter String

Notes

The Scheduler is a tool to run a particular replication job or codeunit automatically on a predefined schedule. Jobs can be scheduled to run at a specified date and time.

The Scheduler processes the Scheduler Job according to the specified given schedule. The Scheduler checks the Next Check Date and Next Check Time fields, and processes the job with the earliest date and time, even if that date and time have passed.

In order to run a specific Scheduler Job, you can assign priorities to the job to ensure that it may run ahead of other Scheduler jobs.

To run Scheduler in LS Central on the Task Scheduler

To run the Scheduler automatically, you must either have NAS to run the Scheduler or use the Task Scheduler.

The NAS cannot run in SaaS, so in that case the Task Scheduler is going to be used. To make the Task Scheduler run the Scheduler you must do the following:

  1. In Scheduler Setup page, enable the Enable NAS Scheduler field. Even though it says NAS Scheduler, the same field works for both NAS or Task Scheduler.
  2. Create a job queue entry for the Scheduler - see below.

Setting up the Scheduler Service in the Job Queue Entry card

To set up the LSC Scheduler Service to run from the Job Queue, create a new Job Queue Entry and configure the following fields:

  1. Fill in the relevant fields in the Job Queue Entry Card, as needed:
  2. Field Description
    Object Type to Run Set to Codeunit.
    Object ID to Run Set to 99001469 (LSC Scheduler Service).
    Parameter String

    Fill in the required parameters.

    For example:

    TYPEFILTER=,LOG=1,REPEAT=0

    See Job Queue Entry Parameter String for a description of each parameter.

    Tip: You may need to click on Show more to make the field visible in the card.

    Recurring Job

    Should be enabled because you want the Scheduler Service to run as a recurring job. To set it as a recurring job, you need to enabled all the Run on ... fields.

    After setting the job as a Recurring Job, you can control the recurrence per scheduled job, in the Scheduler Job card.

    Optionally, you can also specify a time of day for the job to run and how many minutes should elapse between runs.

    No. of Minutes between Runs

    You can set the job queue entry to run every 1 minute.

    This does not mean that the Scheduler Jobs will run every minute. The time between runs is controlled per scheduled job in the Scheduler Job card.

    It is though important to understand that the No. of Minutes between Runs in the Job Queue Entry Card must always be lower than the time interval configured in the Scheduler Job, otherwise the scheduled job might not run as expected.

    Status

    If set to On Hold, the Job Queue Entry will not run. You still can run the scheduler jobs manually for testing purposes.

    For the Job Queue Entry to run, click on Set Status to Ready. The Status will change to Ready. Open the Job Queue Log Entries page to confirm that the Job Queue Entry is running when enabled.

    To confirm if a scheduler jobs is running after enabling the job queue entry, you need to check the Scheduler Log page from the Scheduler Job.

Job Queue Entry Parameter String

The following parameters can be included in the Parameter String field of the Job Queue Entry:

Parameter Description
REPEAT Controls the Scheduler Service heartbeat interval in seconds. Set to 0 (REPEAT=0) so the heartbeat is controlled by the job queue instead.
TYPEFILTER

Filters which Scheduler jobs are processed based on the Scheduler Job Type Code field in the Scheduler Job page. Leave empty (TYPEFILTER=) to process all Scheduler jobs regardless of type.

You can use Business Central filters to specify which job types the Scheduler service should run. For example, TYPEFILTER=DD-FROM-HO|DD-TO-HO|HOSP will run all Scheduler jobs with Scheduler Job Type Code equal to DD-FROM-HO, DD-TO-HO, or HOSP.

LOG Enables status logging. When set to 1 (LOG=1), the Job Queue Entry status is updated after the Scheduler Service codeunit runs, reporting whether the Scheduler service is enabled or disabled based on the Enable NAS Scheduler setting in Scheduler Setup. This is visible in the Job Queue Log Entries for the configured Job Queue Entry.

Tip: For more information on parameters refer to codeunit 99001468.

Notes

In most cases, a single Job Queue Entry running the Scheduler Service codeunit is sufficient to handle all Scheduler jobs.

If there is a need to have more than one Job Queue Entry running the Scheduler Service codeunit, pay close attention to the TYPEFILTER parameter. Each Job Queue Entry should use a different filter to avoid overlapping, meaning both job queues should not end up running the same Scheduler jobs at the same time.

Examples

Scenario Parameter string example Description
Single Job Queue Entry TYPEFILTER=,LOG=1,REPEAT=0 Will run all the configured Scheduler Jobs , no matter what is in the Scheduler Job Type Code
Single Job Queue Entry TYPEFILTER=DD-FROM-HO|DD-TO-HO|HOSP,LOG=1,REPEAT=0 Will run Scheduler Jobs configured with Scheduler Job Type Code equal to DD-FROM-HO, DD-TO-HO or HOSP.
Dual Job Queue Entry

Job 1

TYPEFILTER=DD-FROM-HO|DD-TO-HO,LOG=1,REPEAT=0

Job 2

TYPEFILTER=HOSP,LOG=1,REPEAT=0

Job 1

Will run Scheduler Jobs configured with Scheduler Job Type Code equal to DD-FROM-HO or DD-TO-HO.

Job 2

Will run Scheduler Jobs configured with Scheduler Job Type Code equal to HOSP.