The post-processing element#

When a plug-in step's <command> element finishes processing, the step's mandatory <post-processing> element runs.

The <post-processing> element sets the step's output properties (step name/property name, see Output properties) and provides error handling. The <post-processing> element can contain any valid JavaScript™ 1.7 script (unlike the <command> element, <post-processing> scripts must be written in JavaScript 1.7). Users can also provide their own scripts when they define the step in the HCL™ Launch editor; see Post-processing scripts.

Post-processing scripts have access to the following objects:

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");

You can use a post-processing script to set output properties that can be used in other steps in the same process, which enables complex workflows. In a post-processing (or precondition) script, refer to prior step output properties this way:

properties.get("stepName/propName")

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("regex", function(lineNumber, line) {
     var thing = 'do stuff';
});
scanner.scan();

if (exit == 0) {
    properties.put('Status', 'Success');
}
else {
     properties.put('Status', 'Failure');
}

In instances other than post-processing and precondition scripts, refer to prior step output properties this way:

${p:stepName/propName}

The script that is defined in the <post-processing> element is the step's default behavior. Users can also provide their own script, overriding the default behavior, when they define the step in the process editor. See Editing processes.

Parent topic: Creating plug-ins