> For the complete documentation index, see [llms.txt](https://docs.api.intratool.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.api.intratool.de/api-reference/automation/action-overwrites.md).

# ActionOverwrites

## Introduction

`ActionOverwrites` allow context-specific adjustments of an [Action](/api-reference/automation/actions.md) without modifying the base Action itself.

Typical use case: an Action is defined on a Trigger, but for a specific relatable entity (for example a task assignment), parts of the action `config` or targetables should differ.

## Model Definition

### Relations

| Key           | Relation                                       | Type            | Relation Field(s)                   |
| ------------- | ---------------------------------------------- | --------------- | ----------------------------------- |
| `action`      | [Action](/api-reference/automation/actions.md) | Belongs To      | `action_id`                         |
| `relatable`   | (Polymorphic)                                  | Morph To        | `relatable_type`, `relatable_id`    |
| `users`       | User                                           | Belongs To Many | Pivot `user_action_overwrite`       |
| `departments` | Department                                     | Belongs To Many | Pivot `department_action_overwrite` |

### Traits

* `HasComputedTargetables`
* `HasConfig`
* `HasRelatable`
* `HasTargetableRelations`
* `SoftDeletes`
* `HasFactory`

## Create

Create a new `ActionOverwrite`.

**Definition**

<mark style="color:yellow;">`POST`</mark> `/api/action-overwrites`

**Request Keys**

| Key                        | Type           | Default                               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| -------------------------- | -------------- | ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `action_id`\*              | integer        | -                                     | ID of the base [Action](/api-reference/automation/actions.md) that is overridden.                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `relatable_type`\*         | string         | -                                     | Morph alias of the context entity for this overwrite. Allowed value: `taskAssignment`.                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `relatable_id`\*           | integer        | -                                     | ID of the context entity for this overwrite.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `config`\*                 | object         | -                                     | Partial override config for the selected Action type.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `apply_targetables`        | boolean        | `false`                               | Whether overwrite targetables should be applied.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `assign_mode`              | string         | `none`                                | Targeting strategy for overwrite targetables. Allowed values: `null` (`none`), `all`, `all_users`, `all_group_accounts`, `any_of`, `one_of`, `any_of_user`, `one_of_user`.                                                                                                                                                                                                                                                                                                                                                                          |
| `computed_targetable_type` | string \| null | `null`                                | Optional computed targetable resolver type (depends on base Action type). Available enum values: `for_executing_department`, `for_executing_real_department`, `for_executing_user`, `for_executing_real_user`, `from_task_assignment`, `from_workflow_node`, `from_entity_select_fields_users`, `from_entity_select_fields_departments`, `for_workflow_node_department`, `for_workflow_node_executed_user_department`, `for_workflow_node_user`, `for_workflow_node_executed_user`, `for_system_variable_users`, `for_system_variable_departments`. |
| `user_ids`                 | integer\[]     | `[]` (for assign mode `none/all/...`) | Explicit target users for the overwrite.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `department_ids`           | integer\[]     | `[]` (for assign mode `none/all/...`) | Explicit target departments for the overwrite.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

Keys marked with `*` are required.

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/action-overwrites', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'action_id' => 77,
        'relatable_type' => 'taskAssignment',
        'relatable_id' => 123,
        'config' => [
            'computed_targetables_system_variable' => 'system.user'
        ],
        'apply_targetables' => true,
        'assign_mode' => 'any_of',
        'computed_targetable_type' => 'for_system_variable_users',
        'user_ids' => [5]
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": {
    "id": 1,
    "action_id": 77,
    "relatable_type": "taskAssignment",
    "relatable_id": 123,
    "config": {
      "computed_targetables_system_variable": "system.user"
    },
    "apply_targetables": true,
    "assign_mode": "any_of",
    "computed_targetable_type": "for_system_variable_users",
    "created_at": "2024-01-01 10:00:00",
    "updated_at": "2024-01-01 10:00:00",
    "deleted_at": null
  }
}
```

## Update

Update an existing `ActionOverwrite`.

**Definition**

<mark style="color:blue;">`PUT`</mark> `/api/action-overwrites/{actionOverwrite}`

**Request Keys**

| Key                        | Type           | Default                               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| -------------------------- | -------------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `action_id`                | integer        | -                                     | New base Action ID.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `relatable_type`           | string         | -                                     | New context entity morph alias. Allowed value: `taskAssignment`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `relatable_id`             | integer        | -                                     | New context entity ID.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `config`                   | object         | -                                     | Updated partial override config.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `apply_targetables`        | boolean        | -                                     | Updated flag to apply overwrite targetables.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `assign_mode`              | string         | current assign mode                   | Updated targeting strategy for overwrite targetables. Allowed values: `null` (`none`), `all`, `all_users`, `all_group_accounts`, `any_of`, `one_of`, `any_of_user`, `one_of_user`.                                                                                                                                                                                                                                                                                                                                                                 |
| `computed_targetable_type` | string \| null | -                                     | Updated computed targetable resolver type (depends on base Action type). Available enum values: `for_executing_department`, `for_executing_real_department`, `for_executing_user`, `for_executing_real_user`, `from_task_assignment`, `from_workflow_node`, `from_entity_select_fields_users`, `from_entity_select_fields_departments`, `for_workflow_node_department`, `for_workflow_node_executed_user_department`, `for_workflow_node_user`, `for_workflow_node_executed_user`, `for_system_variable_users`, `for_system_variable_departments`. |
| `user_ids`                 | integer\[]     | `[]` (for assign mode `none/all/...`) | Updated target users for the overwrite.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `department_ids`           | integer\[]     | `[]` (for assign mode `none/all/...`) | Updated target departments for the overwrite.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

All keys are optional for `Update`.

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/action-overwrites/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'config' => [
            'computed_targetables_entity_select_field_ids' => [123, 456, 78]
        ],
        'apply_targetables' => true,
        'assign_mode' => 'any_of',
        'computed_targetable_type' => 'from_entity_select_fields_users',
        'user_ids' => [8]
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": {
    "id": 1,
    "action_id": 77,
    "relatable_type": "taskAssignment",
    "relatable_id": 123,
    "config": {
      "computed_targetables_entity_select_field_ids": [123, 456, 78]
    },
    "apply_targetables": true,
    "assign_mode": "any_of",
    "computed_targetable_type": "from_entity_select_fields_users",
    "created_at": "2024-01-01 10:00:00",
    "updated_at": "2024-01-02 11:00:00",
    "deleted_at": null
  }
}
```

## Delete

Delete an `ActionOverwrite`.

**Definition**

<mark style="color:red;">`DELETE`</mark> `/api/action-overwrites/{actionOverwrite}`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('DELETE', '/api/action-overwrites/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": null
}
```


---

# 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:

```
GET https://docs.api.intratool.de/api-reference/automation/action-overwrites.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
