Post-processing scripts run after a step finishes. Typically,
post-processing scripts ensure that expected results occurred.
Notes: - Use JavaScript 1.7 to write post-processing
scripts.
- In the script, do not use the ${p:component.myProperty}
notation. For example, to set a property named myProp whose value is included in
the output log, enter this
script:
var exit = properties.get('exitCode');
scanner.register("^myProp:", function(lineNumber, line) {
properties.put('myProp', line.substring(7))
});
if (exit == 0) {
properties.put('Status', 'Success');
}
else{
properties.put('Status', 'Failure');
}
- The syntax for post-processing scripts is similar to the syntax for preconditions. See Process step preconditions.
Steps in component processes and generic processes can have post-processing
scripts, but steps in application processes cannot.
Post-processing scripts come from the following sources:
- Steps can have default post-processing scripts. These scripts
are included with the plug-in. See Creating plug-ins.
- You can override the default post-processing script for a step
or provide a post-processing script for a step that does not have
one. See Editing processes.
- You can store post-processing scripts on the server for reuse.
See Storing reusable post-processing scripts.
Post-processing scripts must set the
Status property
to specify the status of the script. The script can specify any value
for the
Status property. For example, to specify
that the script was a success, run the following command in the post-processing
script:
properties.put("Status","Success");
See The post-processing element for examples and more information.