> For the complete documentation index, see [llms.txt](https://docs.tivity.one/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tivity.one/building-an-application/data/data-modelling/action.md).

# Action

## Getting Started

An action defines what kind of activity a user can execute on a class or an instance of a class.

Starting in the **Class Designer,** click on the down arrow on the left side of the class you wish to work on. Next, expand the **Actions** for the class. Go to **Add new action** and enter the name of your action. Press **Enter** to open the action editor.

{% hint style="info" %}
Clicking on an existing action opens it in the action editor to allow changing its configurations.
{% endhint %}

![Class designer: Creating an action](/files/-MBG9slmHS0CXe3yAmUi)

## Common Attributes

The Common section contains general properties of an action. In this section, you can specify how the action is presented in your application by setting the name, description and other information.

![Common attributes for actions](/files/-MBFgt_1zDb0TeZwJjnK)

### Internal Key

The internal key is a unique identifier for your action and defines the name for your action in the database.

{% hint style="info" %}
The **Internal Key** field is compulsory when creating a class.
{% endhint %}

### Name

The action name is a user-friendly name to help users easily identify an action.

{% hint style="info" %}
The **Name** field is compulsory when creating a class.
{% endhint %}

### Description

The action description provides additional information that can be used as help text.

### Valid On

An action can be defined as valid in two scenarios only.

**Class**: The action can be executed outside an instance of the class (e.g. Filter operation)\
**Instance**: The action can only be executed within a concrete instance (e.g. Save operation)

### Is Invisible

This setting defines whether the action is visible in your application or not.

## Mapping Attributes

Similar to classes and fields, action configurations and data are stored in the database. The Mapping section defines how actions are identified and used on a database level by the platform and your application.

![Mapping attributes for actions](/files/-MBFhqTED_Zio513pjEN)

### Key

The mapping key defines the exact name under which your action is saved in the database.

{% hint style="info" %}
The **Key** field is compulsory when creating a class.
{% endhint %}

### Result Data Type

The result data type defines the type of the return value. It mainly describes the value of an action that the source adapter can perform.

{% hint style="success" %}
For instance, a **Download** action would have the **File** result data type.
{% endhint %}

Furthermore, the action can return a list of values by setting the **Result Is List** checkbox to true.

{% hint style="info" %}
This feature is used especially in the context of source adapters. For more information on Result Data Types, see our Source Adapter documentation.
{% endhint %}

### Parameters

Parameters can be used to request information for direct storage in the corresponding class fields when the **NEW** action is executed.

{% hint style="danger" %}
It is important that the parameters have the same key as the respective field.
{% endhint %}

## Advanced Attributes

In the advanced section of an action, you can further customize the flow of an action by defining what happens before and/or after the action is executed.

![Advanced attributes for actions](/files/-MBFizz-p7oNSq0SKP56)

### Before Execute Question

This property allows you to specify a confirmation question that will be displayed to the user before the action is executed. The user has to confirm the dialog for the action to proceed.

{% hint style="success" %}
For instance, on a **Delete** operation, it would make sense to set the Before Execute Question to a confirmation message like: **Are you sure you want to delete this object?**
{% endhint %}

### Post Action

In some cases, an action flow may require it to be followed by **other actions** after execution. This can be specified in the **Post Action** property.

{% hint style="success" %}
For instance, **Open** an instance automatically after the **Create** action has executed.
{% endhint %}

### Scripts

In this section, you can define an additional business logic that must be executed before or after the execution of an action. This is done by creating new scripts.

**Create and Open Pre-Execute Script**: Allows the creation of a script that runs before the action.\
**Create and Open Post-Execute Script**: Allows the creation of a script that runs after the action.

![Pre-request and Post-request Scripts](/files/-MBFjY_drfNkqLR0wVsl)

{% hint style="info" %}
Scripts can be written using the script designer by clicking on the create script button.
{% endhint %}

## Permissions

This section deals with specific action read and write permissions for single users or user groups.

{% hint style="info" %}
More information about permissions can be found in the Rights Designer
{% endhint %}


---

# 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.tivity.one/building-an-application/data/data-modelling/action.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.
