JavaScript Features not Supported in TIBCO BPM Scripting

Certain JavaScript features are not supported.

New Operator

The new operator from JavaScript is not supported. Instead, the factory methods must be used to create new instances of classes.

Switch Statement

The switch statement from JavaScript is not supported:

switch (value) {
    case constant:
         BLOCK;
         break;
    …
    default:
         BLOCK;
         break
}

Instead, an if () {} else if () {} … statement should be used.

try/catch Statement

The try/catch statement is not supported:

try {
        BLOCK;
}
catch (error) {
        BLOCK;
}
Finally {
        BLOCK;
}

The only way to catch an exception in a script is to catch the error on ScriptTask or another task.

JavaScript Functions

JavaScript functions are not supported. Code must be written out in full.

JavaScript RegExp Object

The JavaScript RegExp object is not supported. For example, the Text field replace() method only supports string substitution, not the substitution of a pattern matched by a regular expression.

"==="operator

The === operator (same value and type) is not supported.

JavaScript Arrays

Using [ ] for array indices is not supported, as there is no way to create JavaScript arrays in TIBCO BPM Enterprise. Instead, the List type is used. Consequently, the following loop is not supported:

for (FIELD in ARRAYFIELD) {
         BLOCK;
}