Validations Using Scripts

The Script validation class enables dynamic scripts to be used with validations. There are several different validation levels and some have different parameters. Following are the validation levels and parameters:

Table 12-2 Validation Levels and Parameters

Level Parameter Description

Any level

validation

Provides information about the validation currently executing

Hierarchy

hierarchy

HierarchyObject for the hierarchy being validated

GlobalNode

node

NodeObject for the global node being validated

Node

node

LocalNodeObject for the node being validated

Remove

node

NodeObject for the node being validated

Move

node

LocalNodeObject for the node being moved

move

An object that contains information about the move:

OldParent––LocalNodeObject for the original parent

NewParent––LocalNodeObject for the destination parent

IsPost/IsPre––Indicates whether this script is running just before the move or just after the move has been completed. The script will usually be run twice, once before the move and once after the move.

Values––During the pre-move phase, simple key-value pairs can be stored in this object (for example, Values["key"] = "value"). During the post-move phase, these values are present, enabling you to store information about the pre-move state and compare it to the post-move state. All values are converted to String, Number, or Date objects. Complex objects are not currently supported.

Merge

node

The node being deleted or inactivated

merge

An object that contains information about the merge:

Target––NodeObject for the target of the merge

IsInactivate––True if this is an inactivate operation

IsDelete––True if this is a delete operation

Version

version

VersionObject for the version being validated