StartTaskCause local variable

<< Click to Display Table of Contents >>

Navigation:  Several practical recommendations > Using Variables in Tasks >

StartTaskCause local variable

Each task during execution contains a local variable containing information about the reason for starting the task. The information is a JSON string.

Below are examples, for convenience in a readable form:

{

 "computerName":"",

 "description":"Tray Icon",

 "name":"trigger",

 "remote":"False",

 "taskId":"",

 "triggerId":"E_GENERAL_TRAYICON"

}

 

{

 "computerName":"",

 "description":"Run other Task for test",

 "name":"task",

 "remote":"False",

 "taskId":"3B4E6251",

 "triggerId":""

}

 

To extract a specific JSON field, you can use expressions like these (see using prefixes):

{json:StartTaskCause.name}

{json:StartTaskCause.taskId}

etc.

 

Field descriptions

computerName – the name of the computer from which the task was launched. This field will only be filled in if the task was launched remotely from a network connection. If the task was launched locally from the same RoboTask instance, this field will be empty.

description – a description of the reason as you see it in the RoboTask system log.

name – the actual reason for starting the task. This field can take the following values:

omanual – manual start from the RoboTask main window

otask – start from another task. In this case, the taskId field will contain the ID of the parent task in hexadecimal format.

otrigger – task launched by a trigger. In this case, the trigger type will be recorded in the triggerId field.

ocom – task launched from a built-in COM object (see RoboTaskApp object). This is essentially launching a task from an external script or application using the RoboTask COM interface.

oruntime – task launch in runtime module (see Runtime module).

oerror-handler – task launch as an error handler. The taskId field will contain the ID of the task in which the error occurred and the error handler was launched.

orestserver – task launched from the built-in REST server. (see REST API settings)

odebugger – task launched in the debugger.

ocommand-line – task launched from the command line using the RTaskRun.exe utility

remote – logical value. True – launch from a remote RoboTask via a network connection. In this case, the computerName field will be filled in. False – local launch. The computerName field will be empty.

taskId – parent task ID in 16-digit format. This field will not be empty if the task is launched:

ofrom another task locally

ofrom a remote task via a network connection

othe task is launched as an error handler

In other cases, this field will be empty.

triggerId – trigger ID if the task is launched by a trigger. In other cases, this field will be empty.

 

note Related Topics

Usage of Variables

System variables

Custom variables

Local variables

Create a Variable

Add Variables to a Task

Saving of a result into a variable

Rules for using variables in expressions

Prefixes Used with Variables

How to use variables correctly

Options > Variables