Using Scripts
This section describes how to use scripts.
You can specify scripts in TIBCO Business Studio for use with BPM projects in several ways:
- As part of a script task. See Implementing Script Tasks.
- As an action script on a task, particularly a user task. Action scripts can reference information about individual work items as well as using the parameters and fields defined for your process in TIBCO Business Studio. See Scripts on Other Tasks.
- Attached to a conditional flow, for determining the flow of processing. See Associating a Script with a Conditional Flow.
- Attached to a processing loop applied to a task, to determine how often that task should be performed. See Associating a Script with a Loop.
- On an event. See Timer Event Scripts and also the event activity types in the table below.
Another form of scripting is the use of expressions to define a participant in a task. See Using a Participant Expression to Define a Participant for details of participant expressions.
Scripts may be entered in TIBCO Business Studio as:
- Plain text. When a business analyst creates a process, they may include a plain text description of the desired behavior of any scripts that form part of the process. These plain text entries are not intended to be executable.
- JavaScript. Executable scripts are written in JavaScript. If an analyst has entered a plain text description, it is then part of the solution designer’s role, with the Solution Design capability switched on, to enter JavaScript in order to implement the script.
TIBCO Business Studio supports a subset of standard JavaScript:
- Those standard JavaScript facilities that are not supported in TIBCO Business Studio scripts are described in JavaScript Exclusions.
- Some additional facilities are available. These are described in Editing Scripts and ’Script Functions’ in the Business Data Services Guide.
- Data Mapper. For simple transfer of data between different process data, it may be easier to create scripts with Data Mapper instead of writing them in JavaScript. With Data Mapper, you can graphically map data across datafields and parameters to create complex BOM objects from a combination of process data fields and parameters. This script grammar is available for Script Tasks, Task scripts, Web Services, Call Sub-Processes, and Catch error events. For more information, see Data Mapping and Mapping Contents in Data Mapper.
Different script types can be used as shown in the table below. For each activity type, there are script types that are:
Activity Type | Script Types |
---|---|
User Task | Supported: Open, Close, Submit, Schedule, Reschedule, Initiate, Complete, Timeout, Cancel |
Manual Task
Service Task Send Task Receive Task Reference Task Call Sub-process Activity Embedded Sub-process Activity |
Supported: Initiate, Complete, Timeout, Cancel |
Script Task | Supported: Initiate, Complete, Timeout
In user interface but not supported: Cancel |
Pageflow User Task | Supported: Initiate, Complete
In user interface but not supported: Open, Close, Submit, Schedule |
Multi-instance Task - Multi-instance Loop | Supported: Loop Expression, Complex Exit Expression, Additional Instances Expression |
Multi-instance Task - Standard Loop | Supported: Loop Condition |
Start Event | Supported: Complete |
End Event | Supported: Initiate |
Intermediate Event | Supported: Initiate, Complete, Cancel |