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 multi-select, instead of a free-text box.

Example

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

Upon executing this process the user will be asked for the Current Month. The value will default to 2014 – Jan and when the process is executed the value the user provided will be stored in a variable called current_month. This variable is a global variable and can be accessed in any of the other functions (or in user created functions).

Multi-select example

Passing an array as the fourth argument turns the prompt into a multi-select, limited to the values in that array, rather than a free-text box:

js
script.prompt("Current Month", "current_month", "2014 - Jan", ["2014 - Jan", "2014 - Feb"]);

Execute Process