# Accessing the Script Designer

## Class Designer

Switch your app into Config Mode and navigate to the [Class Designer](https://docs.tivity.one/building-an-application/data/data-modelling). 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="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/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 default script** to add functionality to the field or click on <img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/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"> **Open default script** to modify existing functionality

<div align="center"><img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MChvRRR0SZenF9sK2Gg%2F-MCiBuUgbTpJ4k0TH4-r%2FClass_Field_Advanced_RealField.png?alt=media&#x26;token=96f38feb-3f6f-476e-92ac-4651c48a6c11" alt="Specify a default script of a field"></div>

### Virtual Field

Any field which is marked with the <img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MChvRRR0SZenF9sK2Gg%2F-MCi8p81Gb0V4_jDoMUE%2Ffa-code-fork.png?alt=media&#x26;token=e3588e3b-1097-4f7e-8d8a-f888038f0ec0" 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="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/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 expression script** or <img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/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"> **Open expression script** to access the script definition.

![Scripting the value of a virtual field](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MChvRRR0SZenF9sK2Gg%2F-MCiAQo90wBPiCJmxyhr%2FClass_Field_Advanced_VirtualField.png?alt=media\&token=2a999a4f-cdd1-4429-afbb-bc38f8dcc810)

To remove an existing script from a Virtual field click on <img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBEQ8gEb-V6CREHwPwp%2F-MBERLm_rQfmOyoGQJFV%2Ffa-trash.png?alt=media&#x26;token=c308406b-f14e-4d15-bc8d-75633b2e83b6" 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="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/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"> **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="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/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"> **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](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MChvRRR0SZenF9sK2Gg%2F-MCi3BMGSCOI4xxoC_nc%2FClass_Action_Advanced_Script.png?alt=media\&token=a34d95e9-9fc2-46a6-b849-f4eefc6142ec)

A click on <img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBEQ8gEb-V6CREHwPwp%2F-MBERLm_rQfmOyoGQJFV%2Ffa-trash.png?alt=media&#x26;token=c308406b-f14e-4d15-bc8d-75633b2e83b6" alt="" data-size="line"> **Delete Pre-/Post-Execute Script** removes the script from your action.

## Query Designer

Launch the [Query Designer](https://docs.tivity.one/building-an-application/data/query-data) to create a new query or edit an existing query, and move to the [Fields](https://docs.tivity.one/building-an-application/data/query-data/query-designer-fields) register. In the `Virtual fields` section you click on either <img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/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 script** to add a new script to the query or <img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/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"> **Open script** to modify an existing script.

![Access the Script Designer in the Query Designer](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MCFsH9pnKTwPx-OFaeZ%2F-MCFvbH4QC-g1r8uCYcn%2FQuery_Fields_Scripting.png?alt=media\&token=739f0408-1aeb-4135-b065-736c93dc6f98)

## Template Designer

Activate the Config Mode in your workspace and choose an application to configure. Navigate to the [Template Designer](https://docs.tivity.one/building-an-application/views/document-templates) under **Views** > **Templates** and create a new document template or edit an existing one. In the `Template` section you click on either <img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/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 script** to add a new script to the template or <img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/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"> **Open script** to modify an existing script.

![Document templates can be extended using Scripts](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MEfqE_DSvyEDvo7LaoV%2F-MEg8-NQNSY6t5Ff1pgy%2FTemplate_Scripting.png?alt=media\&token=c3b63408-8696-4bad-8a7a-9331a1dcc948)

## Function Designer

Navigate to your app [Functions](https://docs.tivity.one/building-an-application/execution/scripting/broken-reference) and create or edit a function. Click on either <img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/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 script** to add a new script to the function or <img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/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"> **Open script** to modify an existing script.

![Functions are defined by scripts](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MCFvl0vpimHDhMkV-Ci%2F-MCFyCVX7T4CLnt2gHIJ%2FFunction_Scripting.png?alt=media\&token=167efc00-d17b-4f2f-9bf9-9e11d2cf7119)

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](https://docs.tivity.one/building-an-application/execution/workflows-and-application-logic). 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="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/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 script** to add a new script to the workflow element or <img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/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"> **Open script** to modify an existing script.

![Individual workflow elements can have a script each](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MCFvl0vpimHDhMkV-Ci%2F-MCFzz3yTeHP4cE-3cZo%2FWorkflow_Scripting.png?alt=media\&token=da502c55-9400-4ccd-91c2-9cf4b65d032a)

##
