> 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/budowanie-aplikacji/proces-biznesowy/zadania-automatyczne/zadanie-skryptowe-bpms-scripttask.md).

# Zadanie skryptowe BPMS (scriptTask)

Domyślna opcja Camundy pozwalająca tworzyć proste, szybkie skrypty, bez konieczności tworzenia handlerów Java/ScriptCode.

Dostępne języki to np. Groovy/JavaScript.

## Dokumentacja <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/>

## Podpinanie ScriptTask do procesu <a href="#zadanieskryptowe-scripttask-camundy-podpinaniescripttaskdoprocesu" id="zadanieskryptowe-scripttask-camundy-podpinaniescripttaskdoprocesu"></a>

Wybieramy **Task** i podtyp **ScriptTask**:

* Format: Język np. Groovy/JavaScript,
* Type: Inline Script,
* Script: skrypt, który chcemy wywołać.

<figure><img src="https://1082717226-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>Ilustracja 1.</strong> Przykład podpięcia ScriptTask w procesie</em></p></figcaption></figure>

## Popularne metody <a href="#zadanieskryptowe-scripttask-camundy-popularnemetody" id="zadanieskryptowe-scripttask-camundy-popularnemetody"></a>

```
execution.getVariable("variableName") - Pobiera zmienną procesu
execution.setVariable("variableName", value) - Ustawia zmienną procesu
execution.removeVariable("variableName") - Usuwa zmienną z procesu
execution.hasVariable("variableName") - Sprawdza czy istnieje zmienna w procesie 
execution.getProcessInstanceId() || execution.getId() - pobiera ID procesu
```

<details>

<summary>Ustawnie danych widocznych w Eximee dashboard</summary>

```
    dashboardsParams = [
        "[1]Imię i nazwisko"             : execution.getVariable("clientFullName"),
        "[3]Ogólny typ dyspozycji"       : execution.getVariable("globalCaseTypeName"),
        "[4]Grupa produktowa"            : execution.getVariable("caseGroupName"),
        "[5]Dyspozycja"                  : execution.getVariable("caseTypeName"),
        "[13]Ostatnia osoba procedująca:": execution.getVariable('executorFirstName') +
        " " +
        execution.getVariable('executorLastName') +
        " (" +
        execution.getVariable('executorId') +
        ")"
        ];
 
    if (execution.getVariable("corpFullName") != null) {
        dashboardsParams["[2]Firma"] = execution.getVariable("corpFullName");
        }
 
        dateFormat = "dd.MM.yyyy h:mm"
 
    if (execution.getVariable("startBusinessStatusDate") != null) {
        dashboardsParams["[8]Data rozpoczęcia procesu:"] = execution.getVariable("startBusinessStatusDate").format(dateFormat)
        }
    if (execution.getVariable("tour1BusinessStatusDate") != null) {
        dashboardsParams["[9]Data rozpoczęcia I tury:"] = execution.getVariable("tour1BusinessStatusDate").format(dateFormat)
        }
    if (execution.getVariable("tour2BusinessStatusDate") != null) {
        dashboardsParams["[10]Data rozpoczęcia II tury:"] = execution.getVariable("tour2BusinessStatusDate").format(dateFormat)
        }
    if (execution.getVariable("tour3BusinessStatusDate") != null) {
        dashboardsParams["[11]Data rozpoczęcia III tury:"] = execution.getVariable("tour3BusinessStatusDate").format(dateFormat)
        }
    if (execution.getVariable("endBusinessStatusDate") != null) {
        dashboardsParams["[12]Data zakończenia procesu:"] = execution.getVariable("endBusinessStatusDate").format(dateFormat)
        }
    if (execution.getVariable("sposobWysylki") == "false"){
        dashboardsParams["[14]Sposób wysyłki:"] = "e-mail"
        }
 
execution.setVariable("TASK_DASHBOARD", dashboardsParams);
execution.setVariable("PROCESS_DASHBOARD", dashboardsParams);
```

</details>

<details>

<summary>Obsługa JSONa w 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>Zamiana JSON w typie string na typ Object</summary>

```
// Wartość 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>

Więcej informacji o 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/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.
