> 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](/scripting-reference/types.md#BatchScriptingContextBatchScriptImportSession) | importSession | Enthält Informationen, welche innerhalb von Skripten eines Import-Laufs verwendet werden können | No        |
| [ImportDataMap](/scripting-reference/types.md#ImportDataMap)                                                                  | importData    | eingelesene Import-Daten                                                                        | Yes       |
| [ScriptingServiceList](/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*

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

## BatchScriptAfterbatch

Wird nach dem Import ausgeführt

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

## BatchScriptGuard

Definiert, ob die Aktion ausgeführt werden soll

*Return type:* *boolean*

| 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.vario-software.de/scripting-reference/batch_script.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
