Return Values from Scripts

The following expressions use these return values from scripts to perform certain functions:

  • Conditional flows – Boolean expressions that control whether a path is followed or not.
  • Loop Conditions – Boolean expressions that determine whether a loop should continue or not.
  • Task TimerEvent – Datetime expressions that determine when a task should timeout.

These expressions can be multi-line expressions. The value of the script is the value of the last line in the script. For example, if we want a script to calculate a timeout to be the end of the month, which is 7 days in the future, we can use the following:

var datetime = DateTimeUtil.createDatetimetz();		// get current datetime
datetime.add(DateTimeUtil.createDuration("P7D"));	// change to 7 days time
datetime.setDay(1);					// adjust in case on 31-Jan
datetime.add(DateTimeUtil.createDuration("P1M"));	// move on to next month
datetime.add(DateTimeUtil.createDuration("-P1D"));	// back to end of prev. month
datetime.setTime(0,0,0);				// clear hours, minutes & seconds
datetime;								// return value of script