---
updatedAt: 2025-07-15T08:41:49.000Z
agentTools:
  projectIndex: https://docs.appery.io/llms.txt
---

# SCRIPT Component

Using the SCRIPT component.

The **SCRIPT** component allows you to write flow logic using server-side JavaScript. The result of the script logic has to be returned via a special built-in **result** object.

This simple example shows manipulating a string declared inside the component. Click **Run script** to run the script and see the result (click on the **Result** tab in the code widget):

```text Script
var str = "api key";
result = str.toUpperCase();
```
```text Result
"API KEY"
```

The **SCRIPT** component also has access to all [Components Data](https://docs.appery.io/docs/apiexpress-visual-service-builder-components-data) objects.  Let's look at an example using one of these objects.

Let's say the API Express service defined a request parameter called ***count***. Inside the **SCRIPT** component, you want to check its value and return an appropriate message.

```javascript Script
var count = PARAMS.QUERY.count;
if (count < 10) {
    result = {
        "msg": "Inventory low."
    };
} else {
    resutl = {
        "msg": "Inventory OK."
    };
}
```
```text Result (> 10)
{
  "msg": "Inventory OK."
}
```
```json Result (< 10)
{
  "msg": "Inventory low."
}
```

# Samples

This section has a number of samples using the **SCRIPT** component:

[Video: Learn How to Add Custom Logic with the SCRIPT Component](https://www.youtube.com/watch?v=OfmbOLUHNyc\&list=PLdUnWwhvJspZsEs7mCCl6oHvnAp5ZE0aj\&index=4).