Process step preconditions
Most steps in a process can have a precondition. If the Precondition field is available, the process supports a precondition. This precondition determines whether the step runs. Like post-processing scripts, preconditions use JavaScript™ 1.7.
Preconditions return Boolean values. If the precondition returns True
, the step
runs as usual.
If the precondition returns anything other than True
, the process skips that
step. In the process request, the step is labeled "Precondition Failed." However, in this case, the
process continues to run; the process follows the success links from that step as though the step
succeeded.
- Application properties
- Application process properties
- Environment properties, including component environment properties
- System properties
- Output properties from previous steps. See Output properties.
After you run a process, you can see the properties that the process had access to by opening the process request and clicking the Properties tab.
properties.get("application/property1")
property1
exists and
is not null:properties.get("application/property1") !== undefined &&
properties.get("application/property1") !== null &&
properties.get("application/property1") !== ""
${p:component.myProperty}
in
the precondition script. For example, to check the value of a component property in a component
process, use properties.get("myProperty") == "myValue"
.processProperty1
, you can access that property with the following
code:properties.get("processProperty1")
Step1
specifies
a property that is named OutputProp1
. The following
precondition script allows another step to run only if the value of
this property is value1
:properties.get("Step1/OutputProp1") == "value1"
hasFailures
. This property
is True
if any of the steps in the process fail. It is undefined if no steps fail.
For example, to run a step only if no other steps in the process fail, use the following
precondition:properties.get('hasFailures') == undefined