# Accessing the Script Designer

## Class Designer

Switch your app into Config Mode and navigate to the [Class Designer](/building-an-application/data/data-modelling.md). Navigate to **Data** > **Classes** to access the classes of the app.&#x20;

​‌Select a class, if already available, and expand the **Fields** node to reveal the fields collections.

### Real Field

Either you enter a field name in the **Add new field** data entry and hit *Enter* or you click an existing field to open the configuration view. Next, choose the `Advanced` section and in the `Real field` area you can either click on <img src="/files/-MBjrqDntQEvPrUZw3N9" alt="" data-size="line"> **Create and open default script** to add functionality to the field or click on <img src="/files/-MBjrqDntQEvPrUZw3N9" alt="" data-size="line"> **Open default script** to modify existing functionality

<div align="center"><img src="/files/-MCiBuUgbTpJ4k0TH4-r" alt="Specify a default script of a field"></div>

### Virtual Field

Any field which is marked with the <img src="/files/-MCi8p81Gb0V4_jDoMUE" alt="" data-size="line"> code-fork icon on the right-hand side is a virtual field. Open the configuration view and switch to the `Advanced` section. Make sure the **Get Expression Type** in the `Virtual Field` section is set to `Script` and then click on either <img src="/files/-MBjrqDntQEvPrUZw3N9" alt="" data-size="line"> **Create and open expression script** or <img src="/files/-MBjrqDntQEvPrUZw3N9" alt="" data-size="line"> **Open expression script** to access the script definition.

![Scripting the value of a virtual field](/files/-MCiAQo90wBPiCJmxyhr)

To remove an existing script from a Virtual field click on <img src="/files/-MBERLm_rQfmOyoGQJFV" alt="" data-size="line"> **Delete expression script**.

### Pre-Script and Post-Script of an Action

Expand a class and open the **Actions** node to see the available functionalities. Open the configuration view to create or edit an Action. In the `Advanced` section you click on <img src="https://firebasestorage.googleapis.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBjhTlYxxRF8b7FkWx_%2F-MBjrqDntQEvPrUZw3N9%2Ffa-cubes.png?alt=media&#x26;token=765845d9-1d21-4fe4-ab77-df971c11b8eb" alt="" data-size="line"> **Create and open Pre-Execute-Script** to define a script that is launched before the action is executed or <img src="/files/-MBjrqDntQEvPrUZw3N9" alt="" data-size="line"> **Open Pre-Execute-Script** to amend an existing script. Similarly, you click on <img src="https://firebasestorage.googleapis.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBjhTlYxxRF8b7FkWx_%2F-MBjrqDntQEvPrUZw3N9%2Ffa-cubes.png?alt=media&#x26;token=765845d9-1d21-4fe4-ab77-df971c11b8eb" alt="" data-size="line"> **Create and open Post-Execute-Script** or <img src="/files/-MBjrqDntQEvPrUZw3N9" alt="" data-size="line"> **Open Post-Execute Script** to specify operations needed after the action has run.

![Define pre-execution or post-execution script for an action of a class](/files/-MCi3BMGSCOI4xxoC_nc)

A click on <img src="/files/-MBERLm_rQfmOyoGQJFV" alt="" data-size="line"> **Delete Pre-/Post-Execute Script** removes the script from your action.

## Query Designer

Launch the [Query Designer](/building-an-application/data/query-data.md) to create a new query or edit an existing query, and move to the [Fields](/building-an-application/data/query-data/query-designer-fields.md) register. In the `Virtual fields` section you click on either <img src="/files/-MBjrqDntQEvPrUZw3N9" alt="" data-size="line"> **Create and open script** to add a new script to the query or <img src="/files/-MBjrqDntQEvPrUZw3N9" alt="" data-size="line"> **Open script** to modify an existing script.

![Access the Script Designer in the Query Designer](/files/-MCFvbH4QC-g1r8uCYcn)

## Template Designer

Activate the Config Mode in your workspace and choose an application to configure. Navigate to the [Template Designer](/building-an-application/views/document-templates.md) under **Views** > **Templates** and create a new document template or edit an existing one. In the `Template` section you click on either <img src="/files/-MBjrqDntQEvPrUZw3N9" alt="" data-size="line"> **Create and open script** to add a new script to the template or <img src="/files/-MBjrqDntQEvPrUZw3N9" alt="" data-size="line"> **Open script** to modify an existing script.

![Document templates can be extended using Scripts](/files/-MEg8-NQNSY6t5Ff1pgy)

## Function Designer

Navigate to your app [Functions](broken://pages/-M8HkRswHNU8w4K_rCqe) and create or edit a function. Click on either <img src="/files/-MBjrqDntQEvPrUZw3N9" alt="" data-size="line"> **Create and open script** to add a new script to the function or <img src="/files/-MBjrqDntQEvPrUZw3N9" alt="" data-size="line"> **Open script** to modify an existing script.

![Functions are defined by scripts](/files/-MCFyCVX7T4CLnt2gHIJ)

Scripts defined under Functions allow you to specify the **Return Type** of the value processed.

## Workflow Designer

Open the Config Mode of your app and navigate to **Execution** > **Workflows** to access the list of [Workflows](/building-an-application/execution/workflows-and-application-logic.md). Either create a new workflow or edit an existing one. In the Element Diagram select a Transition or a Step, and access the Script Designer in the `Script` section.

Click on either <img src="/files/-MBjrqDntQEvPrUZw3N9" alt="" data-size="line"> **Create and open script** to add a new script to the workflow element or <img src="/files/-MBjrqDntQEvPrUZw3N9" alt="" data-size="line"> **Open script** to modify an existing script.

![Individual workflow elements can have a script each](/files/-MCFzz3yTeHP4cE-3cZo)

##


---

# Agent Instructions: 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/execution/scripting/accessing-the-script-designer.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.
