A Job can be cancelled via a PowerShell Precheck Job by specifying a specific JAMS Message Code in the Job's source. This can be useful in situations where the PreCheck Job's outcome will determine if the main Job needs to run. The following message codes can be used in a Precheck Job:
Message Code | Description |
CancelJobSuccess | Cancels the main Job with a Success severity. |
CancelJobInfo | Cancels the main Job with an Informational severity. |
CancelJobWarning | Cancels the main Job with a Warning severity. |
CancelJobError | Cancels the main Job with an Error severity. |
The following format should be used to exit with a JAMS message code where "CancelJobSuccess" can be substituted with any of the above Message Codes:
$Host.SetShouldExit(<<JAMS.Message.CancelJobSuccess>>)
The following image shows the source contained in a PreCheck Job that will cancel the main Job with a successful completion:
Comments