How Can We Help?
< Back
You are here:
Print

Conditional Step Execution via Preconditions

Within the definition of Process Steps, the ‘Precondition’ field is an optional javascript block of code which lets you decide if the plugin step should execute. The script should return a boolean value, where true means that the step should be executed and false means that the step should be skipped.

If the precondition fails (by returning false), then the step is skipped. The process log shows ‘Precondition Failed’ for the skipped step.

Referencing Properties within Preconditions

To reference a property, such as ‘sampleProperty’, use the following example as a template.

properties.get("sampleProperty")

Example: Only execute step if an associated property isn’t empty

Often, a step should only be executed if an associated property has a non-empty value. For example, defining an optional step which defines a java classpath from a property, but only if the property, such as ‘classpath’, has a value. The following code can be used as the Precondition for this example.

return (properties.get("classpath").length > 0)

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents