Conditions & Exceptions

Editing transition conditions

The Edit condition panel allows a condition (evaluated during the transition to the next action) to be modified. The banner located above the input area allows the condition’s expression syntax to be edited quickly. Any JavaScript or VBScript expression with a correct syntax can be used as a condition (choose either JavaScript or VBScript next to Language). The syntax is validated upon saving the condition or by clicking the Check the syntax button.

  • This JavaScript implementation is based on ECMAScript 3.5.

  • In JavaScript, time units are expressed in milliseconds:

    • 1 minute = 60,000 milliseconds (1 * 60 * 1000 = 60000)

    • 1 hour = 3,600,000 milliseconds (1 * 60 * 60 * 1000 = 3600000)

    • 1 day = 86,400,000 milliseconds (1 * 24 * 60 * 60 * 1000 = 86400000)

    In conditions, you can divide by the time unit's equivalent in milliseconds to use in comparisons. For example, a notification sent when a request is 12 or more hours late might look like this:

    <WF_SYSTEM_DATETIME> - <WF_ACTIVITY_INST_LIMIT_DATETIME>) / 3600000 >= 12

Functions

Press Ctrl+Space or Alt+Space directly within the editor to display a drop-down list from which you can insert process data and WorkflowGen macros, instead of choosing them from the Data and Macros drop-down lists above the editor.

IIFE

In JavaScript mode, use the Fnc() button to encapsulate the condition in an IIFE (Immediately-Invoked Function Expression). For example:

(function(){
  var myVar = <DATA>
  return myVar == "Lorem ipsum"
})()

Examples

  • Process data equal to Lorem ipsum:

    • JavaScript: <DATA> == "Lorem ipsum"

    • VBScript: <DATA> = "Lorem ipsum"

  • Process data greater than 5:

    • JavaScript: <DATA> > 5

    • VBScript: <DATA> > 5

  • Compare process data dates:

    • JavaScript: <DATE1> > <DATE2>

    • VBScript: DateDiff("s",<DATE1>,<DATE2>) > 0

  • More than 5 hours have elapsed since:

    • JavaScript: (<WF_SYSTEM_DATETIME> - <DATE1>) * 3600000 > 5

    • VBScript: DateDiff("h",<WF_SYSTEM_DATETIME>, <DATE1>) > 5

  • Combination of different comparisons:

    • JavaScript: <DATA1> == "Lorem ipsum" || (<DATA2> > 10000 && <DATA3> == "Director")

    • VBScript: <DATA1> = "Lorem ipsum" Or (<DATA2> > 10000 And <DATA3> = "Director")

  • Process data file has not been defined:

    • JavaScript: <FILE_DATA> == null

    • VBScript: IsNull(<FILE_DATA>)

  • Process data file has a specific size (less than 1 MB) and a specific file name:

    • JavaScript: <FILE_DATA.SIZE> < 1024000 && <FILE_DATA.NAME>.indexOf("report") > -1

    • VBScript: <FILE_DATA.SIZE> < 1024000 And InStr(1,<FILE_DATA.NAME>,"report") > 0

Condition rules

  • You can only add one condition to a transition. To add more conditions between the same actions, create additional transitions between the actions and place the additional conditions on them.

  • You can only place one condition or one exception on a given transition.

  • Each condition is evaluated individually. For example, if there are two conditions on separate transitions between actions, and both are TRUE, then the next action will be created twice.

Editing exceptions

Exception rules

  • You can only add one exception to a transition. To add more exceptions between the same actions, create additional transitions between the actions and place the additional exceptions on them.

  • You can only place one exception or one condition on a given transition.

  • Each exception is evaluated individually. For example, if there are two exceptions on separate transitions between actions, and both exceptions occur, then the next action will be created twice.

  • When an exception occurs at runtime, the default exception is assumed if no specific exception path corresponding to the exception type was defined in the process definition.

  • If an exception path is linked to the end of the process and the exception occurs at runtime, all the ongoing actions are cancelled and the request is closed with the status Closed – Cancelled.

Last updated