> 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/additional-attributes/attribute-field-default-value-sources.md).

# AttributeFieldDefaultValueSources

## Introduction

`AttributeFieldDefaultValueSources` define how an [AttributeField](/api-reference/additional-attributes/attribute-fields.md) gets a prefilled value.

## \[Adm.] Create

Create a default value source for an attribute field.

**Definition**

<mark style="color:yellow;">`POST`</mark> `/api/administration/additional-attributes/fields/default-value-sources`

**Request Keys**

| Key                  | Type            | Default      | Description                                                                           |
| -------------------- | --------------- | ------------ | ------------------------------------------------------------------------------------- |
| `source_type`\*      | string          | -            | Source type. Allowed values: `formFieldValue`, `systemVariable`.                      |
| `form_field_id`\*    | integer         | -            | Target [AttributeField](/api-reference/additional-attributes/attribute-fields.md) ID. |
| `config`             | object          | type default | Source-specific configuration.                                                        |
| `source_entity_type` | string \| null  | `null`       | Morph alias for source entity (for field value sources typically `formField`).        |
| `source_entity_id`   | integer \| null | `null`       | Source entity ID (required with `source_entity_type`).                                |
| `sort_number`        | integer         | auto         | Evaluation order inside one `form_field_id`.                                          |

Keys with `*` are required.

### `config` by `source_type`

* `formFieldValue`
  * no required config keys
* `systemVariable`
  * `variable_key` (required)
  * `variable_filter` (optional, formatter key)

**Example Request**

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/administration/additional-attributes/fields/default-value-sources', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'form_field_id' => 27,
        'source_type' => 'systemVariable',
        'config' => [
            'variable_key' => 'system.user',
            'variable_filter' => 'format_user_name'
        ]
    ]
]);
```

**Example Response**

```json
{
  "status": "success",
  "data": {
    "id": 41,
    "form_field_id": 27,
    "source_type": "systemVariable",
    "config": {
      "variable_key": "system.user",
      "variable_filter": "format_user_name"
    },
    "source_entity_type": null,
    "source_entity_id": null,
    "sort_number": 1
  }
}
```

## \[Adm.] Update

Update an existing default value source.

**Definition**

<mark style="color:blue;">`PUT`</mark> `/api/administration/additional-attributes/fields/default-value-sources/{defaultValueSource}`

**Request Keys**

| Key                  | Type            | Description                                           |
| -------------------- | --------------- | ----------------------------------------------------- |
| `source_type`        | string          | New source type (`formFieldValue`, `systemVariable`). |
| `form_field_id`      | integer         | New target field ID.                                  |
| `config`             | object          | Source-specific configuration.                        |
| `source_entity_type` | string \| null  | New source entity type.                               |
| `source_entity_id`   | integer \| null | New source entity ID.                                 |
| `sort_number`        | integer         | New evaluation order.                                 |

**Example Request**

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/administration/additional-attributes/fields/default-value-sources/41', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'source_type' => 'formFieldValue',
        'source_entity_type' => 'formField',
        'source_entity_id' => 27
    ]
]);
```

**Example Response**

```json
{
  "status": "success",
  "data": {
    "id": 41,
    "form_field_id": 27,
    "source_type": "formFieldValue",
    "config": {},
    "source_entity_type": "formField",
    "source_entity_id": 27,
    "sort_number": 1
  }
}
```

## \[Adm.] Delete

Delete an existing default value source.

**Definition**

<mark style="color:red;">`DELETE`</mark> `/api/administration/additional-attributes/fields/default-value-sources/{defaultValueSource}`

**Request Keys**

No additional request keys.

**Example Request**

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('DELETE', '/api/administration/additional-attributes/fields/default-value-sources/41', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

**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/additional-attributes/attribute-field-default-value-sources.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.
