---
url: /process-functions/script-prompt.md
description: Asks the user running the process for a value.
---

# script.prompt

Asks the user running the process for a value. Call it in `pre()`. The answer is available to the rest of the process as a variable with the name you give it.

```js
script.prompt(messageToUser, variableName, defaultValue, options)
```

## Parameters

| Parameter | Type | Description |
|---|---|---|
| `messageToUser` | `string` | The question to show the user. |
| `variableName` | `string` | The name of the variable to store the answer in. |
| `defaultValue` | `string` | The value to fill the prompt with. |
| `options` | `string[]` | Optional. A list of values for the user to choose from. |

## Examples

```js
script.prompt("Current Month", "currentMonth", "2014 - Jan");
```

```js
// Ask for a month and a region, then load only that data.
function pre() {
    script.prompt("Month", "month", "2026 - Jan");
    script.prompt("Region", "region", "North", ["North", "South", "East", "West"]);
}

function begin() {
    console.log("Loading " + region + " for " + month);
    script.processUpdateQuery(
        "SELECT * FROM sales" +
        " WHERE month = '" + script.escape(month) + "'" +
        " AND region = '" + script.escape(region) + "'"
    );
}
```

## Related

* [script.checkbox](/process-functions/script-checkbox)
* [script.note](/process-functions/script-note)
* [script.processUpdateQuery](/process-functions/script-processupdatequery)
