How to force complete an application or job with Alert?

Document ID : KB000096482
Last Modified Date : 16/05/2018
Show Technical Document Details
Introduction:
An Alert can be used to either force complete a job or the entire application.
Environment:
CA Workload Automation DE 11.3  / 12.x
Instructions:
Login to the DE via Desktop Client.
Setup an Alert under Services -> Alert. 
In the "Run this JavaScript, add the following script
Force Complete Alert
 
execCommand('MY_JOB1','%(APPL._name).%APPL._gen','ACTION COMPLETE REASON("MY_JOB1 had issues")');
To force complete the entire application, use the following script:
execCommand('ALL','%(APPL._name).%APPL._gen','ACTION COMPLETE REASON("Force Completed the application")');

Note:  Put the APPL._name in parenthesis ().  Otherwise, the variable will get changed to uppercase resulting in unresolvable variable.

Next, add the Alert to the Notifications in the job or in the application.  Define the state(s) for the Alert to trigger on.
Choose the Alert
 
Additional Information:
The JavaScript can also be defined in Repository and added from the 'Run a JavaScript from Repository'.