Skip to main content

Job - Conditions​

The Conditions tab of the Job window chooses the Condition Set that the Server checks at the start of each Job run, before any of its Tasks. Use it when the whole Job should run only if something is true at that moment. To check something before one Task instead, use the Conditions tab of the Task window, see Task - Conditions.

A Job uses one Condition Set or none. Check Use for the set you want, or clear it to use none. The choice is saved when you save the Job. Changes to sets made on this tab are saved at once and apply to every Job and Task that uses the set. For the rest of the tab, see Choose the Condition Set for a Job or Task.

When the Job's Condition Set is checked​

The Server checks the Job's Condition Set at the start of each Job run, before any Task starts and before the Job's On start Flow entries. Whether it applies the action depends on how the run was started:

  • Started by a Trigger: applied
  • Started by the "Run Job" action of a Condition Set: applied
  • Started by a Task Flow entry with Stop Job and run specified Job: applied
  • Started by a Run Job Flow entry of another Job, or by a Flow entry of this Job that waits and retries it (Wait … and retry Job): applied only if it was applied to the run that contains that Flow entry. For example, Job A has a Run Job Flow entry that starts Job B. If a Trigger starts Job A, Job B's set is applied. If you start Job A with Run Job, Job B's set is not applied either
  • Started by a Job/Task Control Task with the action "Job - Run Job": checked, but the action is not applied, as on a manual run
  • Started by a Job/Task Control Task with the action "Task - Run Task": applied, and the Task's own Condition Set is applied too
  • A run that waited in the Job queue, for example because the Job has Put Job in queue checked: applied when the run starts from the queue, even if the command that queued it did not apply conditions
  • A missed run that the Server starts when it starts up, for a Job with Run missed Job once at start checked: applied
  • Run manually: see Manual runs

The result selects an action on the Actions tab of the set. In a Job's Condition Set, "Continue" runs the Job and "Retry" checks again. "Next", "Exit", "Run Job" and "Run Task" end the Job before any Task runs, and "Run Job" and "Run Task" then start the chosen Job or Task. See Conditions - Actions for the details and warnings. If the set no longer exists, see Errors and missing Condition Sets.

When a Condition Set ends the Job​

When a Job's Condition Set ends the Job before any Task runs:

  • The Server still records a run of the Job, with a successful result
  • The Job's On start Flow entries do not run
  • The Job's Run Notification Flow entries do not run
  • The Job's other Flow entries for On success and On complete run if their Event condition is "Always" or "If other value". An entry with "If exit code" does not run, because no Task has an exit code yet
  • VisualCron Event Triggers that watch this Job for Job completed or Job completed - successfully fire
  • VisualCron Event Triggers that watch this Job for Job started fire when the run starts, before the set is checked

When a Task's Condition Set ends the Job ("Exit", "Run Job", or "Run Task" with a Task of another Job), the Job's result comes from the Tasks that already ran. If no Task ran, the run is recorded as successful. The Job's Flow entries, including Run Notification, and its completion events then run as for any other run with that result.

warning

A Job that a Condition Set ends before any Task has run is recorded as successful. Its On success and On complete Flow entries that run another Job or retry this Job, unless their Event condition is "If exit code", and the Event Trigger - VisualCron Triggers on its completion, still start Jobs. If another Job must run only after this Job has done its work, start it from a Flow entry of this Job's last Task, with the On success event and Stop Job and run specified Job (see Task - Flow), instead of from the Job's Flow or a completion Trigger.

Manual runs​

How a manual run treats the Job's Condition Set depends on the command you use. On the shortcut menu, each command includes the name of the Job or Task, for example Run Job 'Backup settings' with options. The table leaves the name out.

CommandJob's Condition SetTask Condition Sets
Run JobChecked, action not appliedApplied
Run Job button on the ribbonChecked, action not appliedApplied
Run Job -> Without Conditions -> From first Task or From this TaskChecked, action not appliedApplied
Run Job -> Without raising Trigger eventsChecked, action not appliedApplied
Run Job -> With Conditions -> From first Task or From this TaskAppliedApplied
Run selected Jobs -> Without ConditionsChecked, action not appliedApplied
Run selected Jobs -> With ConditionsAppliedApplied
Run Job with options (see Run Job With Options)Applied only when With Conditions is checked, which it is not by defaultApplied
Run Task on a single TaskApplied. If it ends the Job, the Task does not runNot applied
Run Task -> Without raising Trigger EventsApplied. If it ends the Job, the Task does not runNot applied

When the Job's action is not applied, the log shows the message "Skipping Condition check because the Job was run manually."

note

When its action is not applied, the Job's Condition Set is still checked, so its conditions run, including the code of a .NET condition. With Extended debug logging checked on the set, the check is written to the log.