Skip to content

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

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

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.

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.