yWorkflow Documentation

Pre-built Workflow Extensions

This document provides a reference for the pre-built extensions available in the yWorkflow library. These extensions can be injected into your workflowDefinition definitions to add common functionality without writing custom code.

Functions

Functions are extensions that execute a specific piece of logic at various lifecycle points within the workflowDefinition. They can be configured to run before or after a transition, and also upon entering or leaving a state.

Name Details
persist.input

Persists the value of an input field into the workflowDefinition’s permanent attributes. The input is specified using the name (String) argument.

query.ai

Calls a configured Large Language Model (LLM). The prompt is configured via the prompt (String) argument and can use placeholders (e.g., ${inputs.someValue}) to inject data from the transition’s inputs. Results are placed in transient attributes.

persist.transient.attribute

Saves a transient attribute to the workflowDefinition’s permanent attributes, making it available for the lifetime of the instance. The attribute is specified using the name (String) argument.

Conditions

Conditions evaluate to true or false to control workflowDefinition logic dynamically. Beyond enabling transitions, they are used to define join conditions (allowing a join state to proceed), determine if a capability is available in the current state, or verify if a specific transition result (destination) is permitted.

Name Details
check.state.owner

A visibility condition that ensures a transition is only shown as available if the current state’s owner matches the user requesting the list of transitions.

check.join.states.status

A condition used on a 'join' state transition. It prevents execution until all sibling states from the corresponding 'fork' have reached a specific status. The required status is set via the status (String) argument (defaults to COMPLETED).

check.state.status

Checks if a specific workflowDefinition state is in a given status. Specify the target using stateName (String) and the expected status with status (String).

Attribute Registers

Attribute Registers initialize and make new attributes available to other extensions during a transition.

Name Details
register.logger

Initializes and makes an SLF4J logger instance available in the transient attributes for other extensions to use. It can then be accessed in scripts, for instance, via transients.log.

Input Validators

Input Validators check user-provided data during a transition and can cause the transition to fail if the data is invalid.

Name Details
validate.input

Validates an input field. Use the required (Boolean) argument to fail the transition if the input is missing. Use the format (String) argument to validate the input’s value against a regular expression.