Menu Item icon

Menu Item

Displays a Menu Item

Overview

This node, named "Menu Item," is designed to display a menu option within a workflow. It allows users to define a menu item with customizable properties such as its path (main or branch), descriptive name, type, and introductory text. The node supports input validation, branching rules, and execution of custom code processors before, during, and after processing the input.

Common scenarios for this node include building interactive menus in workflows where user input or branching logic is required. For example, it can be used to create a decision tree where each menu item leads to different branches based on user choices or input validation results.

The node also supports running custom JavaScript or Python code either once for all input items or individually per item, enabling complex data transformations or validations within the menu flow.

Properties

Name Meaning
Path Defines whether this menu item belongs to the natural path of the tree ("Main") or represents a branch ("Branch").
Node Name A short descriptive name for the menu item, helping identify it within the workflow.
Node Type The type of node; default is "MENU_ITEM", indicating this node represents a menu option.
Validation Failure Text Text displayed if the user enters an invalid value according to the validation rule.
Menu Introduction Text Text shown as an introduction or prompt for the menu item, e.g., instructions or a message like "Please select an option".
Input VariableName The name of the input variable associated with this menu item.
Variables (formFields) A collection of variables that define input fields, each with a name, type (String, Number, JSONArray, JSONObject), and a required value.
Input Validation A regular expression string used to validate the user's input against specific criteria.
Status Indicates whether the menu item is active, inactive, or in test mode. Options: Active, Inactive, Test.
Choose Processor Allows specifying processors to execute at different stages: Pre Processor, Input Processor, Post Processor. Each processor is defined by a name or value string.
Mode Determines how the custom code runs: either once for all input items ("Run Once for All Items") or once per each input item ("Run Once for Each Item").
Language Programming language for the custom code execution. Options include JavaScript and Python (Beta).
JavaScript The actual JavaScript code to execute within the node. Supports special variables for dates and JSON querying.
Skip Rule A rule defined as a string to skip execution of this node under certain conditions.
Branching Rule Rules defining branching logic, which can be node-based or text-based, allowing dynamic workflow paths depending on evaluated conditions.
Flags Collection of boolean flags controlling behavior: Sanitize input, mark as last node, close session after execution, publish workflow output.

Output

The node outputs JSON data representing the result of the executed code or processed input. The structure includes:

  • json: The main output containing the processed data or error messages.
  • binary (optional): If present, contains binary data related to the output.
  • pairedItem: Metadata linking output items to their corresponding input items when processing multiple inputs.

If errors occur during code execution, the output JSON will contain an error field with the error message.

Dependencies

  • The node uses an internal sandbox environment to safely execute custom JavaScript or Python code.
  • It relies on helper utilities for standardizing output and managing sandbox contexts.
  • No external API keys or services are required by default.
  • Environment variable CODE_ENABLE_STDOUT controls whether console logs from the sandboxed code are forwarded to the UI or logged to the console.

Troubleshooting

  • Code Execution Errors: If the custom JavaScript or Python code throws errors, the node outputs an error message in the JSON. Users should verify their code syntax and logic.
  • Validation Failures: If input does not match the specified regular expression, the node displays the configured validation failure text.
  • Skipping Node: If the skip rule evaluates to true, the node may not execute as expected; ensure the skip rule logic is correct.
  • Incorrect Branching: Misconfigured branching rules can lead to unexpected workflow paths; verify branching expressions carefully.
  • Mode Misconfiguration: Choosing the wrong mode (run once vs. run per item) might cause unexpected behavior in multi-item workflows.

Links and References

Discussion