Timer Event Scripts

Scripts can be added to Start events or Catch Intermediate events in the Properties view, if the event is defined as triggered by a timer.

There are several script types available from the Script Defined As list:

  • Free Text - the Business Analyst or person who created the process can use this field to enter text that describes the desired behavior for the script.
    Note: On the General tab, there may already be text comments describing the required script. These comments will be lost if you change the select JavaScript from the Script Defined As list. If you need to save these comments, copy them before changing the script type.
  • Constant Period - this allows you to specify the timeout period after the event is initiated using the following time units.
    Note:
    • At runtime the timeout period is calculated using the calcDeadline API operation described in "BusinessDeadlineService" in the TIBCO ActiveMatrix BPM Developer’s Guide. Note that if you specify a date without a time element (no hours or smaller units) then the period is assumed to be in working days.
    • The calendarLookAhead property in the dac.properties file specifies how far ahead the algorithm should look when calculating the timeout. If there is not enough working time available to complete the task in the period defined by calendarLookAhead, an error is returned. The property defaults to a value of one month, but you should ensure that it is set to a large enough value to give correct results for your calculations.

      See "Configuring TIBCO ActiveMatrix Calendar Properties" in TIBCO ActiveMatrix BPM Administration for more details of this property.

  • JavaScript - this script type allows you to enter JavaScript statements in the space provided. The script should return a datetime or datetimetz type for an absolute datetime deadline, or a duration if the in-scope calendar is to be used. The script can be as long as you like, but the result of the script must be one of those types. For example:

In this example, the DateTime is specified using one of the DateTimeUtil factory methods described in ’Script Functions’ in the Business Data Services Guide. The event will be fired at the date and time specified.

If only a Date were present, the event would fire immediately when the deadline is created (in the runtime environment) on the Date specified. If only a Time were specified, the event would fire at the specified time on the current date.