---
title: "Action custom_modules__set"
description: "Creates a custom module record and stores it in a constant."
---

# Action `custom_modules__set`

> **System ID:** `action_custom_modules__set`

## Description

Creates a new record in a custom module. Fields are taken from the `fields` parameter or from user constants (names like `{module_name}:{field_name}`). The created record (with ID) is stored in the `set_to` / `saved_entity` constant or in the module name.

## Events (scenario branches)

| Event | When it occurs |
|-------|----------------|
| **success** | Record created and stored in a constant |
| **error** | Missing `module_name`, creation failed, or record has no ID |

## Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `module_name` | string | yes | — | Custom module alias (name); `model` is also accepted |
| `bot_id` | number | no | current bot | Module bot ID |
| `fields` | object | no | `null` | Explicit field values; otherwise — from user constants |
| `set_to` | string | no | module name | Constant for storing the created record; also `saved_entity` |

## Configuration example

```json
{
  "module_name": "customer",
  "fields": {
    "first_name": "John",
    "last_name": "Doe",
    "email": "john@example.com"
  },
  "set_to": "new_customer"
}
```

## Related docs

- [Actions reference](/en/actionjail/reference/actions-reference.md)
