Skip to main content
Version: 2025.0

process

Provides Functions regarding process executions and process timers.

Methods

createProcessHistoryRequest

createProcessHistoryRequest(): GetProcessHistoryRequest

Creates a new empty request object to query entries of the process history.

If no further settings are made to the request, the query returns all entries of the process history, sorted by start time in descending order.

The provided setter methods can be used to specify additional search parameters and set options for paging.

Example:

Returns

a new empty request object to query entries of the process history.

Example

// Create a new process history request
var request = process.createProcessHistoryRequest();

// Specify the attributes of searched entries
request.setProcessNames(["myProcess_1", "myProcess_2"]) // List of process names
.setExecutionUIDs(["P-01", "P-02"]) // List of executionUIDs
.setSystemIDs(["default", "default-bg"]) // List of ADITO systems
.setServerUIDs(["default-F0A2", "default-bg-DCA3"]) // List of unique server UIDs
.setFromStartTime(Date.now()); // Earliest start time of the process in ms

// Specify the parameters for paging
request.setPagingOffset(0) // Start index of the page
.setPagingLimit(10); // Element count of the page

// Additional parameters.
request.setProcessHistoryLimit(5) // Defines how many entries per process are returned
.useAscendingOrder() // Sorts all results in ascending order based on the start time
.useDescendingOrder() // Sorts all results in descending order based on the start time (default)
.useNoOrder(); // Results are returned in no specific order

var historyEntries = getProcessHistory(request);

createStartAsyncConfig

createStartAsyncConfig(): StartProcessAsyncConfig

Create and return a config object to start an asynchronous process via startAsync

The value for "ProcessName" is mandatory. All other elements, if not set, will be used with their defaultvalues.

Defaultvalues:

ThreadPriority: THREADPRIORITY_NORM

TimerType: TIMERTYPE_SERVER_RUN

Returns

StartProcessAsyncConfig Config Object to set the values via the available setters


createStartConfig

createStartConfig(): StartProcessConfig

Create and return a config object to start a synchronous process via start

The value for "ProcessName" is mandatory.

Returns

StartProcessConfig Config Object to set the values via the available setters


createStartScriptConfig

createStartScriptConfig(): StartScriptConfig

Create and return a config object to start an inline script via startScript

The value for "ProcessName" is mandatory.

Returns

StartProcessConfig Config Object to set the values via the available setters


createStartTimedConfig

createStartTimedConfig(): StartProcessTimedConfig

Create and return a config object to start a timed process via startTimed

The values for "ProcessName" and "Identifier" are mandatory. All other elements, if not set, will be used with their defaultvalues.

Defaultvalues:

ThreadPriority: THREADPRIORITY_NORM

TimerType: TIMERTYPE_SERVER_RUN

Returns

StartProcessTimedConfig Config Object to set the values via the available setters


execute()

execute(pName, pLocalVariables): string

This method can be used to execute a process.

This process will not be executed within the current frame context, but directly within the client (or server) context.

This means that the $sys.currentwindow and $sys.currentimagevariables are not available.

To execute a process within the current context, use the appropriate functions. This process will not prevent the client from being executed.

Parameters

pName
string | number | boolean

The name of the process to be executed.

pLocalVariables
any

A map with variables (key, value – values only as strings) that are passed to the process as $local variables. The name of the corresponding variable in the process is then "$local.key". 'Null' if you do not want to pass variables.

Returns

string

The result as a string, or 'null' if no result exists.

Deprecated

This API is deprecated.

Throws

May throw an exception.


Example

var result = process.execute("testprocess", null);
question.showMessage(result);
//"testprocess" is a global process with
//the following code: return.string("Hello world!"); **//object data is passed**
var lunch = new Array();
lunch["tasty"] = "Tom Yum";
lunch["restaurant"] = "Siam";
process.execute("test_process", lunch);

executeAsync()

executeAsync(pName, pLocalVariables, pShowErrorDialog, pUser, pThreadPriority, pTimerType?): void

Runs a process in the background. If this function is executed in the client context, then its variables are available.

Parameters

pName
string | number | boolean

The name of the process to run.

pLocalVariables
any

A map with variables (key, value only string) that are passed to the process as $local variables. The name of the corresponding variable in the process is then "$local.[key] ". 'Null' if you do not want to pass variables.

pShowErrorDialog
boolean

'true' indicates, if possible, an error message can be used only in the client context.

pUser
string | number | boolean

The title of the user under which name the process is running. Used only in server context.

pThreadPriority
number

The priority of the thread, see process.THREADPRIORITY_*

pTimerType?
number

The timer type, see process.TIMERTYPE_*.

Returns

void

Deprecated

This API is deprecated.

Throws

May throw an exception.


executeScript()

executeScript(pIdentifier, pScript, pLocalVariables, pAlias): string

Executes the code you passed. The execution works the same way as for process.execute(), but the code is passed directly.

Parameters

pIdentifier
string | number | boolean

An identifier that can be used to recognize the script

pScript
string | number | boolean

The code to be executed. Imports within the script must be separated by "\r\n".

pLocalVariables
any

A map with variables that are passed to the process as $local variables. The name of the corresponding variable in the process is then "$local.[Key]". 'Null' if you do not want to pass variables.

pAlias
string | number | boolean

The alias to be used for the script; 'null' for the current context alias.

Returns

string

The result as a string, or 'null' if no result exists.

Deprecated

This API is deprecated.

Throws

May throw an exception.


Example

var script = "import(\"system.result\");\r\nimport(\"system.vars\");\r\nimport(\"system.logging\");\r\n logging.log(vars.getString(\"$local.result\"));\r\nresult.string(vars.getString(\"$local.result\"));";
process.executeScript("[evalscript]", script, {"result": "test"}, null); // returns "test"

executeTimer()

executeTimer(pIdentifier, pName, pInterval, pRunImmediately, pShowErrorDialog, pTimerType, pUser, pKeepJDito, pThreadPriority, pLocalVariables?): void

This method executes a global JDito process as a timer.

This process will not be executed within the current context, but within the client or server context.

This means that the $sys.currentwindow and $sys.currentimage variables are not available.

To execute a process within the current context, use the appropriate functions.

Parameters

pIdentifier
string | number | boolean

The unique name of the timer.

pName
string | number | boolean

The name of the process to be executed.

pInterval
number

The interval, in milliseconds, in which the process is to be executed.

pRunImmediately
boolean

If 'true', the process will be run once immediately after starting the timer.

pShowErrorDialog
boolean

"true" shows an error message if an error occurs (if possible, only if TIMERTYPE_CLIENT_RUN).

pTimerType
number

The timer type, see process.TIMERTYPE_*.

pUser
string | number | boolean

The user under whose name the process will be executed. 'Null' for anonymous. Not for TIMERTYPE_CLIENT_RUN.

pKeepJDito
boolean

'true' will create a JDito instance only once and then re-use it again and again (for server processes).

pThreadPriority
number

The priority of the thread: process.THREADPRIORITY_*.

pLocalVariables?
any

A map with variables (key, value only string) that are passed to the process as $local variables. The name of the corresponding variable in the process is then "$local.[key] ". 'Null' if you do not want to pass variables.

Returns

void

Deprecated

This API is deprecated.

Throws

May throw an exception.


Example

process.executeTimer("PENDING_TIMER_STARTER", "start_timer", datetime.ONE_SECOND * 30, true, false, process.TIMERTYPE_SERVER, null, false, process.THREADPRIORITY_HIGH);

existsTimer

existsTimer(pIdentifier): boolean

Checks whether a timer with the specified identifier already exists.

Parameters

pIdentifier
string | number | boolean

The identifier of the timer process.

Returns

boolean

'true' if the timer exists.

Throws

May throw an exception.


Example

var exists = process.existsTimer("WORKFLOW");

getActiveTimers

getActiveTimers(): string[]

Returns the IDs of the active timers.

Returns

string[]

The IDs of the active timers as an array.

Throws

May throw an exception.


Example

var timers = process.getActiveTimers();

getExecutionHistory

getExecutionHistory(pProcessName): ProcessExecutionLog[]

Returns information about the execution history of the given processes (by name).

Parameters

pProcessName
string[]

the process names as array

Returns

an array of ProcessExecutionLog objects

Throws

May throw an exception.


getExecutionHistoryByUID

getExecutionHistoryByUID(pExecutionUID): ProcessExecutionLog[]

Returns information about the execution history of the given process executions (by uid).

Parameters

pExecutionUID
string[]

the process execution uids as array

Returns

an array of ProcessExecutionLog objects

Throws

May throw an exception.


getMetadataMultiple

getMetadataMultiple(pOnlyActives): ProcessInfos[]

Loads infos about all processes specified as VARIANT_EXECUTABLE. For further infos see getMetadataSingle

Parameters

pOnlyActives
boolean

If true only active executable processes are returned otherwise all of them

Returns

Array of JScriptProcess.ProcessInfos

Throws

AditoException


getMetadataSingle

getMetadataSingle(pProcessName): ProcessInfos

Loads infos about a timed process. Use the getters of the returned JScriptProcess.ProcessInfos Object to access the desired infos or use JScriptProcess.ProcessInfos.getAsJson to get it as JSON object.

Parameters

pProcessName
string | number | boolean

Name of the process added as timer

Returns

JScriptProcess.ProcessInfos Object containg infos or null if the desired process couldn't be found

Throws

AditoException


getProcesses

getProcesses(pVariantNames): string[]

Returns a list of process names having the specified variant

Parameters

pVariantNames
string[]

List of the variants for which the processes should be loaded

Returns

string[]

List of process names

Throws

AditoException


getProcessHistory

getProcessHistory(pProcessHistoryRequest): ProcessExecutionLog[]

Returns information about the execution history of all processes matching the given request object.

Example:

Parameters

pProcessHistoryRequest

The process history request for which the matching entries are returned.

Returns

An array of ProcessExecutionLog objects that match the conditions of the request.

Throws

May throw an exception.

Example

var request = process.createProcessHistoryRequest()
.setProcessNames(["myProcess_1", "myProcess_2"])
.setSystemIDs(["default"])
.setPagingOffset(0)
.setPagingLimit(10);

var historyEntries = getProcessHistory(request);

getTimedProcessConfiguration

getTimedProcessConfiguration(pTimerId): StartProcessTimedConfig

Loads a saved timed process configuration which has been saved using storeTimedProcessConfiguration(...)

Important: The values localVariables and runImmediately are NOT persisted, set again if necessary

Parameters

pTimerId
string | number | boolean

Id of an existing timer in the format of [ProcessName].process.

Returns

The config containing the data for the specific timer or null if timerId doesn't exist

Throws

AditoException


isRunningTimer

isRunningTimer(pIdentifier): boolean

Checks whether a timer with the specified identifier is currently being executed.

Parameters

pIdentifier
string | number | boolean

The identifier of the timer process.

Returns

boolean

'true' if it is being executed; otherwise 'false'.

Throws

May throw an exception.


Example

var wfrun = process.existsTimer("WORKFLOW");
if(wfrun)
{
question.showMessage(process.isRunningTimer("WORKFLOW");
}

start

start(pConfig): string

This method can be used to execute a process.

Use createStartConfig to create a configuration.

Parameters

pConfig

The config object, created with createStartConfig()

Returns

string

The result as a string, or 'null' if no result exists.

Throws

AditoIllegalStateException

Example

var startConfig = process.createStartConfig()
.setName("MyProcessName") var result = process.start("myProcessName", null);
**//Object that contains the processes local variables**
var localVars = new Array();
localVars["myVar1"] = "content1";
localVars["myVar2"] = "content2";

var startConfig = process.createStartConfig()
.setName("MyProcessName")
.setLocalVariables(localVars) process.start(startConfig);

Execution always happens on the server it has been started on.

Throws

AditoIllegalArgumentException

Throws

May throw an exception.


startAsync

startAsync(pConfig): void

This method can be used to start an asynchronous process.

Use createStartAsyncConfig to create a configuration.

Parameters

pConfig

The config object, created with createStartAsyncConfig()

Returns

void

Throws

AditoIllegalStateException

Example

var startConfig = process.createStartAsyncConfig()
.setName("MyProcessName") var result = process.startAsync("myProcessName", null);
**//Object that contains the processes local variables**
var localVars = new Array();
localVars["myVar1"] = "content1";
localVars["myVar2"] = "content2";

var startConfig = process.createStartAsyncConfig()
.setName("MyProcessName")
.setLocalVariables(localVars) process.startAsync(startConfig);

Execution always happens on the server it has been started on.

Throws

AditoIllegalArgumentException

Throws

May throw an exception.


startScript

startScript(pConfig): string

Executes the passed script.

Parameters

pConfig

The config object, created with createStartScriptConfig()

Returns

string

The result as a string, or 'null' if no result exists.

Throws

AditoIllegalStateException

Throws

AditoIllegalArgumentException

Throws

May throw an exception.


startTimed

startTimed(pConfig): void

This method can be used to start a timed process.

Use createStartTimedConfig to create a configuration.

If the intervall is lower or equal to 0, the process will be started using startTimed with the desired identifier and defaultvalues.

The Process will be executed on the specified servers. This timed execution works in a Server Cluster. It is recommended to use the Cloud Manager as it uses an active push mechanism to broadcast the processes instead of polling.

Parameters

pConfig

The config object, created with createStartTimedConfig()

Returns

void

Throws

AditoException

Example

var startConfig = process.createStartAsyncConfig() <br/>.setName("MyProcessName") var result = process.startTimed("myProcessName", null);
<b>//Object that contains the processes local variables</b>
var localVars = new Array();
localVars["myVar1"] = "content1";
localVars["myVar2"] = "content2";
<br/> var startConfig = process.createStartConfig() <br/>.setName("MyProcessName") <br/>.setLocalVariables(localVars) process.startTimed(startConfig);

stopTimer

stopTimer(pIdentifier): void

Stops the timer with the specified identifier. If no timer with the identifier exists, nothing will happen.

Parameters

pIdentifier
string | number | boolean

The identifier of the timer process.

Returns

void

Throws

May throw an exception.


Example

process.stopTimer("WORKFLOW");

storeTimedProcessConfiguration

storeTimedProcessConfiguration(pConfig): void

Saves a timed process configuration. To load the configuration use getTimedProcessConfiguration(...) with the timerId

Important: The values localVariables and runImmediately are NOT persisted

Parameters

pConfig

Config to store

Returns

void

Throws

AditoException

Properties

INTERVAL_UNIT_DAY

number

Unit: Day


INTERVAL_UNIT_HOUR

number

Unit: Hour


INTERVAL_UNIT_MINUTE

number

Unit: Minute


INTERVAL_UNIT_MONTH

number

Unit: Month


INTERVAL_UNIT_SECOND

number

Unit: Second


INTERVAL_UNIT_WEEK

number

Unit: Week


STARTTYPE_INTERNAL

string

Internal process, which was started by the server itself.


STARTTYPE_MANUAL

string

The process was manually triggered by a user, or an interface.


STARTTYPE_TIMER

string

The process was triggered by a configured timer.


THREADPRIORITY_HIGH

number

Priority of the current thread in process.executeTimer(): high priority


THREADPRIORITY_LOW

number

Priority of the current thread in process.executeTimer(): low priority


THREADPRIORITY_NORM

number

Priority of the current thread in process.executeTimer(): normal priority


THREADPRIORITY_VERYHIGH

number

Priority of the current thread in process.executeTimer(): very high priority


THREADPRIORITY_VERYLOW

number

Priority of the current thread in process.executeTimer(): Very low priority


TIMERTYPE_CLIENT_RUN

number

Timertyp: This timer exists once per client; it runs as long as the client is running.


TIMERTYPE_CLUSTER

number

Timertyp: This timer exists once per cluster; it is started automatically after a cluster failure. Last run is saved when the cluster is stopped and is scheduled to restart when the server is restarted.


TIMERTYPE_SERVER

number

Timertyp: This timer exists once per server; it is started automatically after a server failure. Last run is saved when the server is stopped and is scheduled to restart when the server is restarted. In Multi-Server environments, most like this is not the desired timer type as processes will be run on every server. TIMERTYPE_CLUSTER ist a better choice in the vast majority of cases.


TIMERTYPE_SERVER_RUN

number

Timertyp: This timer exists once per server; it runs as long as the server is running. In Multi-Server environments, most like this is not the desired timer type as processes will be run on every server. TIMERTYPE_CLUSTER ist a better choice in the vast majority of cases.


VARIANT_EXECUTABLE

string

Variant: Executable


VARIANT_LIBRARY

string

Variant: Library


VARIANT_NONE

string

Variant: None


VARIANT_SYSTEM

string

Variant: System


VARIANT_WEBSERVICE

string

Variant: Webservice


VARIANT_WORKFLOW

string

Variant: Workflow