SYS_ACT_PARENT_NR

Use the SYS_ACT_PARENT_NR script function to retrieve the RunID of the processor or activator of the current task (the task that contains the script). The script function returns the session ID if the task is activated manually by a user. The task can be any type of executable object. For more information about processors and activators, see Superordinate Tasks (Parents).

Tip: Use GET_PARENT_NR to retrieve the RunID of the processor or activator of a different task by specifying the RunID. For more information, see GET_PARENT_NR.

Syntax

SYS_ACT_PARENT_NR ([Activation type])

Parameters

  • SYS_ACT_PARENT_NR
    Retrieves the RunID of the activator or processor, or the session ID if the task is activated by a user

  • Activation type
    (Optional) Specifies the type of activation
    Allowed values:

    • ACT
      Activator
      Parent task that activates the task, or user who manually activates the task
    • PRC
      Processor (default)
      Other means of activating the task
      Note: If you do not specify an activation type, the script function retrieves the processor (default).

Return Codes

The script function has the following return codes:

  • RunID of the activator or processor
  • Session ID
    (ACT only) Task was activated manually by a user
    For more information, see Last session in Users (USER).
  • Empty value
    (PRC only) No parent task exists

Note: To retrieve information about a group, the task that contains the script function must be generated at runtime. If the task is generated at activation time, you can only use SYS_ACT_PARENT_NR on the Post Process page to retrieve information about groups. For more information, see Generating at Activation or at Runtime.

Examples

The following script retrieves and uses the RunID of a task to return information about the activator of the task in the activation report.

:SET &NR# = SYS_ACT_PARENT_NR(ACT)
:
PRINT "RunID of parent is &NR#."

If a user manually activated the task, the message in the activation report contains the last session ID for the user:

2018-11-06 15:26:01 - U00020408 RunID of parent is 0001000081.

If the task was activated by a parent task such as a Workflow, the activation report contains the RunID of the parent task:

2018-11-06 15:26:01 - U00020408 RunID of parent is 0001004056.

The following script checks if the current task was activated by a parent task. If yes, the script prints the RunID of the parent in the activation report. If the task was not activated by a parent task, the script prints the message No parent.

:SET &NR# = SYS_ACT_PARENT_NR()
:
IF &NR#  = " "
:   
PRINT "No parent"
:
ELSE
:   
PRINT "RunID of parent is &NR#."
:
ENDIF

See also: