The return command in Twidget is a special command used to halt the current command workflow and immediately return a specified result. This command overrides any subsequent processes and outputs the return result regardless of the rest of the workflow logic. This command is particularly useful for error handling, conditional exits, or when a certain result needs to be promptly returned.
<result>: The value or object you want to return. This result can be a simple data type (e.g., text, number, boolean) or a complex object.When the return command is executed, it:
Stops the execution of the current workflow.
Discards any further processing or commands that follow it in the workflow.
Outputs the specified result as the final output of the workflow.
It is imperative to consider how the return command fits into your overall output schema since it will determine the structure and type of the final output.
Output Schema: Ensure the output schema of your workflow accounts for the type of results that might be returned by the return command.
Workflow Design: Carefully design your workflows to use the return command appropriately for intended early exits or error handling mechanisms.
Command Placement: Place the return command where specific conditions are met to avoid unintended workflow terminations.
The return command is powerful for controlling the flow and output of workflows in Twidget. By understanding its behavior and correctly implementing it in your workflows, you can create more efficient and effective automation processes.
Realtime commands
Use these commands in endpoints, server functions and events to connect authenticated customers and send live notifications. Start with [Realtime channels](/docs/builder/realtime) to create a channel and choose its audience. Authorize Realtime. Issue a one-use connection ticket for the signed-in cus...
XML commands
Use XML commands when a service sends or expects XML documents. They work with the same variable controls as other commands. Parse XML. Add Parse XML, supply the XML text and choose a mode. SIMPLE is convenient when you need fields from a straightforward document. ORDERED preserves the order of elem...
AI connectors
For every command’s inputs, results, examples and common errors, open the [detailed connector reference](/docs/connectors/overview). The command editor’s help button opens its exact reference section. Use an AI provider from an endpoint, server function or event. Choose your organization's connector...
Managing Files
Twidget offers a set of commands to manipulate files in your file store. Below are the descriptions and usage of each command to help you understand how to utilize them effectively. For CSV, ZIP archives and temporary download links, see [Advanced file commands](/docs/commands/advanced-files). Get F...
Business connectors
For every command’s inputs, results, examples and common errors, open the [detailed connector reference](/docs/connectors/overview). The command editor’s help button opens its exact reference section. Connect common business apps to your endpoints, server functions and events. Choose an app, connect...