Input workflow activity
Summarize
Summary of Input workflow activity
The Input workflow activity enables the creation of interactive phone menus within Notify calls. It presents callers with a list of options, allowing them to respond by pressing phone keys. This activity is essential for building dynamic, user-driven call flows in ServiceNow workflows.
Show less
Input Variables
Several input parameters control the behavior of the Input activity:
- Number of digits: Maximum digits a caller can enter before completing their selection.
- Finish key: A key that the caller can press to indicate they have finished entering digits.
- Timeout (in seconds): Duration to wait before automatically closing the menu if no selection is made.
- Advanced option: When checked, allows the menu to be built via a custom script rather than static conditions.
- Script: Defines a JavaScript object that specifies menu options with either audio URLs (using the
playattribute) or text-to-speech prompts (usingspeakandlanguageattributes). Custom data attributes can also be included.
Conditions
Conditions define the menu options and determine workflow transitions based on caller input. Key points include:
- Each condition represents a phone menu option, with the text read aloud to the caller.
- Condition names can include language prefixes to support multiple languages.
- Transitions depend on caller input digits, matched using JavaScript expressions like
parseInt(workflow.scratchpad.digits) == <expected digit>. - An error condition can be configured to handle invalid inputs or script errors.
Scratchpad Entries
The activity writes important values to the workflow scratchpad for persistence and later use:
- workflow.scratchpad.digits: Stores the digits entered by the caller.
- workflow.scratchpad.menu<activity name>: Stores the entire menu object returned by the advanced script, which can be accessed in subsequent workflow activities to retrieve custom data based on the caller’s selection.
Practical Application
ServiceNow customers can use the Input activity to build flexible phone menus that respond to caller input with audio prompts or text-to-speech. The advanced scripting option offers customization for complex menus and data handling. By defining conditions and leveraging scratchpad variables, workflows can branch dynamically based on caller choices, improving caller experience and automation capabilities.
The Input activity creates a phone menu by presenting a list of options on a Notify call.
Input Variables
Input variables determine the initial behavior of the activity.
| Variable | Description |
|---|---|
| Number of digits | Specify the maximum number of digits the caller can enter. A caller can enter fewer digits than the maximum and press the Finish key to complete the entry. |
| Finish key | Specify the key a caller can press on their phone when finished selecting a menu option. |
| Timeout (in seconds) | Specify the amount of time to wait before closing the menu automatically when the caller does not select a menu option. |
| Advanced | Select this check box to use a script to build the phone menu, instead of using the activity conditions. |
| Script | Define the script to build the phone menu. The script must specify an
answer variable as a JavaScript object with the following
format:
The script may specify either a text-to-speech string and language code using the speak attribute or URL of the music to be played using the play attribute. You can also add optional attributes to store related information, such as myCustomData in the example above. Note: The script object continues to support
say attribute for backward compatibility. |
Conditions
The conditions determine the transition that comes after this activity.
The input activity does not specify any conditions by default. You must define conditions to build the phone menu. Each condition is one option on the phone menu. Notify reads the text from each condition Name to the caller, up to 100 characters per condition.
You can specify a language for each condition by prefixing the message with the language code, in the format xx-XX:<Message>. For example, add fr-CA: for Canadian French. Available languages are stored on the Notify Language [notify_language] table.
The condition that the activity transitions through depends on the digits entered by the caller. Set the condition Condition value to parseInt(workflow.scratchpad.digits) == <expected digits>. For example, to transition through a condition when the caller presses the number 3, set the Condition to parseInt(workflow.scratchpad.digits) == 3.
You can add an error condition to this activity. The activity transitions through the error condition if the advanced script returns an invalid value, or if the text to say for a condition is empty.
Scratchpad Entries
The activity uses the workflow scratchpad to write persistent values.
| Entry | Description |
|---|---|
| workflow.scratchpad.digits | The digits entered by the caller, as a string. |
| workflow.scratchpad.menu<activity name> | The entire answer variable, if using the advanced script
option. You can access this menu from other activities after this activity
successfully executes. For example, if the activity name is
choices, you can access values from the menu
using |