For the complete documentation index, see llms.txt. This page is also available as Markdown.

Process operations and data access

Interface api.process.v1 provides mechanisms for interacting with the process engine (BPM) of the Eximee platform. It allows asynchronous control of the process flow (by sending messages) and dynamic management of permissions for cases on the user's case list.

API

interface ProcessApi {
    v1: {
        /* Sends messages to the process, 
         * optionally process variables can be passed.
         */
        correlateMessage(messageName: string, processVariables?: { [key: string]: string });

        /* Sets the list of groups, 
         * that have access to the process instance on the case list
         */
        setAccessGroups(groupNames: string[]);

        /* Starts a new process based on the process definition key.
         * Optionally, a business key and process variables can be passed. 
         * Returns the process instance identifier.
         */
        startProcess(definitionKey: string, data?: StartProcessOptions): string;

        /* Allows referencing another process based on its instance identifier. 
         * Enables performing operations on this process, 
         * such as sending messages or setting access groups.
         */
        byInstanceId(processInstanceId): ProcessApi.v1;

        /* Returns information about the process, 
         * such as its key, name, instance identifier, business key.
         */
        getProcessInfo(): ProcessInfo;
        /* Returns information about the current user task, 
         * such as its key, name, identifier.
         */
        getUserTaskInfo(): UserTaskInfo;

        // Returns the list of incidents of the process instance (current or specified by byInstanceId)
        getIncidents(): Incident[];

        // Retries the external task execution; retries specifies the number of retries (default 1)
        retryExternalTask(externalTaskId: string, retries?: number): void;
    }
}

interface StartProcessOptions {
    // Optional business key for the new process instance
    businessKey?: string;

    // Optional process variables for the new process instance
    variables?: { [key: string]: string };
}

interface ProcessInfo {
    // Returns the process instance identifier
    id(): string;

    // Returns the process definition key
    definitionKey(): string;

    // Returns the process name, if set
    name(): string | null;

    // Returns the business key of the process, if set
    businessKey(): string | null;
}

interface UserTaskInfo {
    // Returns the user task identifier
    id(): string;

    // Returns the user task definition key
    definitionKey(): string;

    // Returns the user task name
    name(): string;
}

interface Incident {
    // Returns the incident identifier
    id(): string;

    // Returns the incident type: "failedJob", "failedExternalTask" or a custom type
    incidentType(): string;

    // Returns the identifier of the element the incident concerns: external task (for "failedExternalTask") or job (for "failedJob")
    configuration(): string | null;

    // Returns the error message
    incidentMessage(): string | null;

    // Returns the date and time of the incident in yyyy-MM-dd'T'HH:mm:ss.SSSZ format, e.g. 2026-01-23T14:42:45.000+0200
    incidentTimestamp(): string;

    // Returns the process definition identifier
    processDefinitionId(): string | null;

    // Returns the process instance identifier
    processInstanceId(): string | null;

    // Returns the execution identifier (path) in the process instance
    executionId(): string | null;

    // Returns the process step where the incident is visible
    activityId(): string | null;

    // Returns the process step where the error actually occurred
    failedActivityId(): string | null;

    // Returns the identifier of the incident that directly caused this incident
    causeIncidentId(): string;

    // Returns the identifier of the source incident; if it equals id(), this incident is the source incident
    rootCauseIncidentId(): string;

    // Returns the job definition identifier (for "failedJob")
    jobDefinitionId(): string | null;

    // Returns the tenant identifier, if multi-tenancy is used
    tenantId(): string | null;

    // Returns the note added manually to the incident
    annotation(): string | null;
}

Action context

The API is available from the object api.process.v1 and operates in the context of the current process. Process identifier:

  • For platform-launched forms within a process — filled in automatically.

  • For resumed processes (e.g. via the endpoint #/process) — the process instance identifier must be provided.

  • For script tasks — absolutely required.


Reference to another process

Method
Description

byInstanceId(processInstanceId)

Changes the call context to the specified process instance. Returns an object allowing process methods to be called (e.g. correlateMessage).

The API for such a case is available at:

where processInstanceId is the identifier of the process instance we want to reference.

Availability: The API is available only in:

  • scripts,

  • script validators,

  • script tasks.

Usage examples

1. correlateMessage()

Method
Description

correlateMessage(messageName, [processVariables])

Sends a message named messageName. Optionally accepts a key-value map representing process variables to update.

Sending a message named MESSAGE_NAME

Sending a message with a process variable set

Sending a message to a specific process

Sending a message to a specific process with multiple variables

2. setAccessGroups()

Method
Description

permissions.setAccessGroups(groupNames)

Sets the list of groups that have access to the process instance on the case list.

Operation description

Method grants additional access to viewing the case (process instance) on the case list.

  • The group must have previously been granted permission to the list: feature_process_list (case list) or feature_case_list (list of all cases).

  • Method overwrites all previously assigned groups.

Usage example

To reset access groups, overwrite the current values with an empty list.


Starting a new process

The API also allows starting a new process. When using this functionality, you should consider the possibility of scripts being called multiple times and ensure the operation is idempotent.

Method
Description

startProcess(definitionKey, [data])

Starts a new process based on the process definition key; optionally, a business key and process variables can be passed. Returns the process instance identifier.

Care must be taken not to start multiple process instances as a result of repeated script execution (e.g. by a user refreshing the page, attaching the script multiple times, or binding it to an event that may be triggered repeatedly).

Usage examples

Starting a process with a business key and process variables:

Starting a process without additional parameters:

Retrieving process information

The API allows you to retrieve information about the current process, such as its key, name, instance identifier, or business key.

Method
Description

getProcessInfo()

Returns information about the process, such as its key, name, instance identifier, business key.

Usage examples

Retrieving user task information

The API also allows you to retrieve information about the current user task, such as its key, name, or identifier.

Method
Description

getUserTaskInfo()

Returns information about the current user task, such as its key, name, identifier.


Retrieving process incidents

Method getIncidents() returns a list of process instance incidents. An incident is created when the process engine cannot execute a process step, e.g. after exhausting the retries of an asynchronous task or external task. If the instance has no incidents, the method returns an empty list.

  • api.process.v1.getIncidents() — returns incidents of the current process instance.

  • api.process.v1.byInstanceId(processInstanceId).getIncidents() — returns incidents of the specified process instance.

The structure of the returned object is described in the interface Incident in section API and corresponds to the object IncidentDto from EximeeBPMS REST API. Syntax hints in the script editor include the method call, but do not suggest methods of returned objects.

Method configuration() returns the identifier of the element the incident concerns: for type failedExternalTask it is the identifier of the external task that you pass to the method retryExternalTask(). For type failedJob it is the job identifier — retrying jobs is currently not available in the API.

Usage examples

Return the number of incidents of the current process instance:

Return the number of incidents of the process whose identifier was passed to the script in the input parameter processInstanceId:


Retrying an external task

Method retryExternalTask(externalTaskId, retries) sets the number of retries for the external task, allowing the process engine to attempt execution again and resolve the associated incident.

  • externalTaskId — the identifier of the external task. For incidents of type failedExternalTask it is returned by the method configuration().

  • retries — number of retries. The parameter is optional; the default value is 1. The value must be greater than or equal to 1; providing a lower value results in an error.

Usage examples

Retrying all external tasks with incidents in the specified process instance:

Retrying an external task with three execution attempts:

See also: Important information can be found in the section Case list configuration and Eximee Dashboard permissions.

Last updated

Was this helpful?