---
url: /technical/using-process-prompts.md
description: >-
  When used in the pre () function, upon execution of the process this function
  will raise a question to the user executing the process.
---

# Using Process Prompts

When used in the pre () function, upon execution of the process this function will raise a question to the user executing the process.

#### Usage

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

#### Parameters

* `messageToUser` the name of the request to the user (who is executing the process).
* `variableName` the variable within which to store the users response.
* `defaultValue` the default value to prepopulate the prompt with.
* `options` *(optional)* an array of values to offer as a dropdown, instead of a free-text box. The user picks one.

#### Example

Both forms in a single `pre()` function - the first prompt takes free text, the second is limited to a fixed list:

![The pre() function, annotated to show the three-argument prompt and the four-argument prompt carrying a list](/process-prompts-script.png)

When the process runs, each prompt becomes a field in the **Execute Process** dialog. The three-argument prompt renders a text box; the one carrying a list renders a dropdown restricted to those values:

![The Execute Process dialog, annotated to show the free-text field and the dropdown](/execute-process.png)

Whatever the user enters is stored in the named variable - `monthvar` and `accountvar` here. These are global, so any other function in the process can read them.

::: tip Give every prompt a sensible default
The third argument prepopulates the field. For a list prompt it should be one of the values in the array, otherwise the dialog opens with nothing selected.
:::
