> For the complete documentation index, see [llms.txt](https://developer.vario-software.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.vario-software.de/scripting-reference/batch_script.md).

# Module: batch\_script

## BatchScriptingContext

### Attributes:

| Datatype                                                                                                                                                         | Name          | Description                                                                                     | Read-only |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------------------------------------- | --------- |
| *Array*                                                                                                                                                          | errorMessages | Fehlermeldungen, die im Laufe der Skriptverarbeitung aufgetreten sind                           | No        |
| [BatchScriptingContext$BatchScriptImportSession](https://developer.vario-software.de/scripting-reference/types.md#batchscriptingcontextbatchscriptimportsession) | importSession | Enthält Informationen, welche innerhalb von Skripten eines Import-Laufs verwendet werden können | No        |
| [ImportDataMap](https://developer.vario-software.de/scripting-reference/types.md#importdatamap)                                                                  | importData    | eingelesene Import-Daten                                                                        | Yes       |
| [ScriptingServiceList](https://developer.vario-software.de/scripting-reference/services.md#scriptingservicelist)                                                 | services      | Services                                                                                        | Yes       |
| *Map\<string,object>*                                                                                                                                            | parameters    | Parameter zur Verwendung im Skript                                                              | No        |

## BatchScriptAction

Die in der Stapelverarbeitung auszuführende Aktion

*Return type:* *boolean*

*The callback may be declared `async`; the returned promise is awaited before processing continues.*

| Datatype                                        | Name | Description    | Required |
| ----------------------------------------------- | :--: | -------------- | -------- |
| [BatchScriptingContext](#batchscriptingcontext) |  ctx | Import-Kontext | Yes      |

## BatchScriptAfterbatch

Wird nach dem Import ausgeführt

*The callback may be declared `async`; the returned promise is awaited before processing continues.*

| Datatype                                        | Name | Description    | Required |
| ----------------------------------------------- | :--: | -------------- | -------- |
| [BatchScriptingContext](#batchscriptingcontext) |  ctx | Import-Kontext | Yes      |

## BatchScriptGuard

Definiert, ob die Aktion ausgeführt werden soll

*Return type:* *boolean*

*The callback may be declared `async`; the returned promise is awaited before processing continues.*

| Datatype                                        | Name | Description    | Required |
| ----------------------------------------------- | :--: | -------------- | -------- |
| [BatchScriptingContext](#batchscriptingcontext) |  ctx | Import-Kontext | Yes      |

## Instance: batchAction

### Description

Aktionen innerhalb einer Stapelverarbeitung

### Methods

***setAction***

Setter für Callback "action"

| Datatype                                |   Name   | Description       | Required |
| --------------------------------------- | :------: | ----------------- | -------- |
| [BatchScriptAction](#batchscriptaction) | callback | Callback "action" | Yes      |

***setGuard***

Setter für Callback "guard"

| Datatype                              |   Name   | Description      | Required |
| ------------------------------------- | :------: | ---------------- | -------- |
| [BatchScriptGuard](#batchscriptguard) | callback | Callback "guard" | Yes      |

***setAfterBatch***

Setter für Callback "afterBatch"

| Datatype                                        |   Name   | Description           | Required |
| ----------------------------------------------- | :------: | --------------------- | -------- |
| [BatchScriptAfterbatch](#batchscriptafterbatch) | callback | Callback "afterBatch" | Yes      |

```
import batchAction from "batch_script";

batchAction.setGuard( (ctx) => {
    // Should the action be performed for the current import record?
    return true;
});

batchAction.setAction( (ctx) => {
    // Execute action for the current import record. true/false for success/failure.
    return true
});

batchAction.setAfterBatch( (ctx) => {
    // Action to be performed after an import block
});

```


---

# 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://developer.vario-software.de/scripting-reference/batch_script.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.
