SYS_ACT_TOP_NR

Use the SYS_ACT_TOP_NR script function to retrieve the RunID of the topmost Workflow. The task that contains the script function can be a child of the top Workflow, or can be nested at any level within the Workflow.

Note: If an object starts from the Postconditions tab, the Workflow is not a direct parent but only the activator of the script. In this case, this script function returns the properties of the activator.

Syntax

SYS_ACT_TOP_NR ()

Return Codes

The script function has the following return codes:

  • RunID of the top Workflow
  • Empty value
    Task was not activated by a Workflow

Example

The following script in a task retrieves the RunID of the parent task, and of the top Workflow. The script compares the retrieved values to determine whether the parent task is the top Workflow. A conditional block in the script sends the user a message with the appropriate information.

: SET &TNR# = SYS_ACT_TOP_NR ()
:
 SET &PNR# = SYS_ACT_PARENT_NR ()

:
 IF &TNR# =  &PNR# 
:
 IF &TNR# = " " 
:
 SEND_MSG ADMIN,AE, "Task does not run in a Workflow." 
:
 ELSE 
:
 SEND_MSG ADMIN,AE, "Task runs in the Workflow with RunID &TNR#. The Workflow is the top Workflow." 
:
 ENDIF 
:
 ELSE 
:
 SEND_MSG ADMIN,AE, "Task runs in a nested Workflow. The RunID of the top workflow is &TNR#." 
:
 ENDIF

See also: