> For the complete documentation index, see [llms.txt](https://docs.eximee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/proces-biznesowy/zadania-automatyczne/zadanie-skryptowe-bpms-scripttask.md).

# BPMS script task (scriptTask)

Camunda's default option that allows you to create simple, fast scripts without the need to create Java/ScriptCode handlers.

Available languages include e.g. Groovy/JavaScript.

## Documentation <a href="#zadanieskryptowe-scripttask-camundy-dokumentacja" id="zadanieskryptowe-scripttask-camundy-dokumentacja"></a>

<https://docs.eximeebpms.org/manual/latest/reference/bpmn20/tasks/script-task/>

<https://docs.eximeebpms.org/manual/latest/user-guide/process-engine/scripting/>

## Attaching ScriptTask to a process <a href="#zadanieskryptowe-scripttask-camundy-podpinaniescripttaskdoprocesu" id="zadanieskryptowe-scripttask-camundy-podpinaniescripttaskdoprocesu"></a>

We choose **Task** and subtype **ScriptTask**:

* Format: Language e.g. Groovy/JavaScript,
* Type: Inline Script,
* Script: the script we want to invoke.

<figure><img src="https://2112972046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2CssJT0zIo4SJQLbSZ6l%2Fuploads%2F2EGyQ070bZ3cEgZufgAY%2FZrzut%20ekranu%20z%202026-10-12%2010-11-59.png?alt=media&amp;token=5fb5d265-ee9b-406e-a834-354afe5aaba0" alt=""><figcaption><p><em><strong>Figure 1.</strong> Example of attaching ScriptTask in a process</em></p></figcaption></figure>

## Common methods <a href="#zadanieskryptowe-scripttask-camundy-popularnemetody" id="zadanieskryptowe-scripttask-camundy-popularnemetody"></a>

```
execution.getVariable("variableName") - Gets the process variable
execution.setVariable("variableName", value) - Sets the process variable
execution.removeVariable("variableName") - Removes the variable from the process
execution.hasVariable("variableName") - Checks whether a variable exists in the process 
execution.getProcessInstanceId() || execution.getId() - gets the process ID
```

<details>

<summary>Setting data visible in the Eximee dashboard</summary>

```
    dashboardsParams = [
        "[1]First and last name"             : execution.getVariable("clientFullName"),
        "[3]General type of disposition"       : execution.getVariable("globalCaseTypeName"),
        "[4]Product group"            : execution.getVariable("caseGroupName"),
        "[5]Disposition"                  : execution.getVariable("caseTypeName"),
        "[13]Last person processing:": execution.getVariable('executorFirstName') +
        " " +
        execution.getVariable('executorLastName') +
        " (" +
        execution.getVariable('executorId') +
        ")"
        ];
 
    if (execution.getVariable("corpFullName") != null) {
        dashboardsParams["[2]Company"] = execution.getVariable("corpFullName");
        }
 
        dateFormat = "dd.MM.yyyy h:mm"
 
    if (execution.getVariable("startBusinessStatusDate") != null) {
        dashboardsParams["[8]Process start date:"] = execution.getVariable("startBusinessStatusDate").format(dateFormat)
        }
    if (execution.getVariable("tour1BusinessStatusDate") != null) {
        dashboardsParams["[9]Start date of round I:"] = execution.getVariable("tour1BusinessStatusDate").format(dateFormat)
        }
    if (execution.getVariable("tour2BusinessStatusDate") != null) {
        dashboardsParams["[10]Start date of round II:"] = execution.getVariable("tour2BusinessStatusDate").format(dateFormat)
        }
    if (execution.getVariable("tour3BusinessStatusDate") != null) {
        dashboardsParams["[11]Start date of round III:"] = execution.getVariable("tour3BusinessStatusDate").format(dateFormat)
        }
    if (execution.getVariable("endBusinessStatusDate") != null) {
        dashboardsParams["[12]Process end date:"] = execution.getVariable("endBusinessStatusDate").format(dateFormat)
        }
    if (execution.getVariable("sposobWysylki") == "false"){
        dashboardsParams["[14]Sending method:"] = "e-mail"
        }
 
execution.setVariable("TASK_DASHBOARD", dashboardsParams);
execution.setVariable("PROCESS_DASHBOARD", dashboardsParams);
```

</details>

<details>

<summary>Handling JSON in JS</summary>

```
const data = execution.getVariable("kgSymulatorData")
const cif = S(data).prop("cif").value()
const creditAmount = S(data).prop("creditAmount").value()
const phone =  S(data).prop("phone").value()
const email = S(data).prop("email").value()
 
 
execution.setVariable("cif", cif);
execution.setVariable("creditAmount", creditAmount);
execution.setVariable("phone", phone);
execution.setVariable("email", email);
```

</details>

<details>

<summary>Converting JSON from string type to Object type</summary>

```
// Value skpToControl -> [{"skp":"198500"},{"skp":"198700"}]
def raw = execution.getVariable("skpToControl")
def parsed = new groovy.json.JsonSlurper().parseText(raw)
 
def list = parsed.collect { item ->
    def m = [:]
    item.each { k, v -> m[k] = v }
    return m
}
 
execution.setVariable("skpObj", list)
```

</details>

More information about JSON: [https://docs.camunda.org/manual/7.7/reference/spin/json/01-reading-json/](https://docs.camunda.org/manual/7.7/reference/spin/json/01-reading-json/?__hstc=218867270.701d355f32e667d247d52b3da539ef04.1729075947404.1729075947404.1729075947404.1&__hssc=218867270.1.1729075947404&__hsfp=456839464#reading-json-properties)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/proces-biznesowy/zadania-automatyczne/zadanie-skryptowe-bpms-scripttask.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
