Built-ins
WorkflowNodeDefinition
Connect a workflow-builder entry to the executor that runs it.
Use the node ID as the stable subtype stored by workflows. The executor supplies the node's configuration form, input and output contracts, and ports.
| Setting | Type | Default | Description |
|---|---|---|---|
id | str | Required | Stable node ID stored in workflows. |
documentation | str | '' | Markdown and tagged examples included in the generated developer reference. |
type | Literal['ACTION', 'FLOW', 'TRIGGER'] | Required | Category for the editor and execution engine, validated during registration. |
name | str | Required | Name shown in the workflow editor. |
description | str | Required | Summary of the node's behavior. |
executor_cls | Optional[Type[BaseExecutor]] | None | Executor class that provides configuration, data contracts, ports, and execution. |
icon | Optional[str] | None | Icon shown beside the node. |
Register an action that extracts a title
An action consumes the incoming payload and returns its output for the next node.
from typing import Any
from bloomerp.automation.base_executor import BaseExecutor
from bloomerp.automation.registry import WORKFLOW_NODE_REGISTRY, WorkflowNodeDefinition
class ExtractTitleExecutor(BaseExecutor):
'''Project the incoming title into a small output object.'''
def execute(self, trigger_data: dict[str, Any]) -> dict[str, str]:
'''Return the incoming title as text.'''
return {"title": str(trigger_data.get("title", ""))}
extract_title = WorkflowNodeDefinition(
id="EXAMPLE_EXTRACT_TITLE",
type="ACTION",
name="Extract title",
description="Copy the incoming title into the output.",
executor_cls=ExtractTitleExecutor,
)
WORKFLOW_NODE_REGISTRY.register(extract_title.id, extract_title)Give a workflow action a configuration form
The workflow editor uses the executor’s form to collect the amount. The executor resolves it against the current input.
from typing import Any
from django import forms
from bloomerp.automation.base_executor import BaseExecutor
from bloomerp.automation.registry import WORKFLOW_NODE_REGISTRY, WorkflowNodeDefinition
class AddDaysConfig(forms.Form):
'''Collect the number of days to add to a numeric input.'''
days = forms.IntegerField(min_value=0, initial=1)
class AddDaysExecutor(BaseExecutor):
'''Add a configured number of days to an incoming day count.'''
config_form = AddDaysConfig
def execute(self, trigger_data: dict[str, Any]) -> dict[str, int]:
'''Return the adjusted day count.'''
config = self.resolve_config(trigger_data)
return {"days": int(trigger_data["days"]) + int(config["days"])}
add_days = WorkflowNodeDefinition(
id="EXAMPLE_ADD_DAYS",
type="ACTION",
name="Add days",
description="Add a configurable amount to a day count.",
executor_cls=AddDaysExecutor,
)
WORKFLOW_NODE_REGISTRY.register(add_days.id, add_days)On Object Create
ID ON_OBJECT_CREATE
Triggered when a new object is created
| Field | Value |
|---|---|
type | TRIGGER |
icon | fa-solid fa-circle-plus |
On Object Update
ID ON_OBJECT_UPDATE
Triggered when an object is updated
| Field | Value |
|---|---|
type | TRIGGER |
icon | fa-solid fa-pen-to-square |
On Object Create or Update
ID ON_OBJECT_CREATE_OR_UPDATE
Triggered when an object is created or updated
| Field | Value |
|---|---|
type | TRIGGER |
icon | fa-solid fa-arrows-rotate |
On Object Deletion
ID ON_OBJECT_DELETE
Triggered when an object is deleted
| Field | Value |
|---|---|
type | TRIGGER |
icon | fa-solid fa-trash-can |
On Schedule
ID SCHEDULE
Triggered on a defined schedule
| Field | Value |
|---|---|
type | TRIGGER |
icon | fa-solid fa-clock |
Human Trigger
ID HUMAN_TRIGGER
Triggered by a human. Used for testing purposes.
| Field | Value |
|---|---|
type | TRIGGER |
icon | fa-solid fa-hand-pointer |
Send Email
ID SEND_EMAIL
Sends an email to specified recipients
| Field | Value |
|---|---|
type | ACTION |
icon | fa-solid fa-envelope |
Get Object
ID GET_OBJECT
Get a specific object by ID
| Field | Value |
|---|---|
type | ACTION |
icon | fa-solid fa-database |
Create Object
ID CREATE_OBJECT
Creates a new object in the database
| Field | Value |
|---|---|
type | ACTION |
icon | fa-solid fa-database |
Update Object
ID UPDATE_OBJECT
Updates an existing object in the database
| Field | Value |
|---|---|
type | ACTION |
icon | fa-solid fa-pen |
Delete Object
ID DELETE_OBJECT
Delete an existing object in the database
| Field | Value |
|---|---|
type | ACTION |
icon | fa-solid fa-trash |
Enrich Data
ID ENRICH_DATA
Enriches the input data with additional fields
| Field | Value |
|---|---|
type | ACTION |
icon | fa-solid fa-magic |
Extract Field
ID EXTRACT_FIELD
Extracts a field from the incoming value
| Field | Value |
|---|---|
type | ACTION |
icon | fa-solid fa-code |
Call API
ID CALL_API
Makes an external API call
| Field | Value |
|---|---|
type | ACTION |
icon | fa-solid fa-cloud-arrow-up |
List Objects
ID LIST_OBJECTS
List different objects
| Field | Value |
|---|---|
type | ACTION |
icon | fa-solid fa-list |
Send User Message
ID SEND_USER_MESSAGE
Send a message to a user
| Field | Value |
|---|---|
type | ACTION |
icon | fa-solid fa-message |
Generate PDF
ID GENERATE_PDF
Generate a pdf from a document template
| Field | Value |
|---|---|
type | ACTION |
icon | fa fa-file-pdf |
SQL Query
ID SQL_QUERY
Execute a raw SQL query against the database
| Field | Value |
|---|---|
type | ACTION |
icon | fa-solid fa-database |
Compute
ID COMPUTE
Compute a value using a custom Python function
| Field | Value |
|---|---|
type | ACTION |
icon | fa-solid fa-calculator |
Human in the Loop
ID HUMAN_IN_THE_LOOP
Pauses the workflow and waits for a human to provide input
| Field | Value |
|---|---|
type | ACTION |
icon | fa-solid fa-hand-paper |
Wait
ID WAIT
Pauses the workflow for a certain amount of seconds
| Field | Value |
|---|---|
type | ACTION |
icon | fa-solid fa-clock |
If Condition
ID IF_CONDITION
Routes input through a true or false output
| Field | Value |
|---|---|
type | FLOW |
icon | fa-solid fa-code-branch |
Filter Objects
ID FILTER_OBJECTS
Filters a collection of objects based on field values
| Field | Value |
|---|---|
type | FLOW |
icon | fa-solid fa-filter |
For Each
ID FOR_EACH
Runs the downstream branch once for each item in a collection
| Field | Value |
|---|---|
type | FLOW |
icon | fa-solid fa-repeat |
Collect
ID COLLECT
Collects all results from a For Each into one ordered list
| Field | Value |
|---|---|
type | FLOW |
icon | fa-solid fa-layer-group |
Merge Branches
ID MERGE_BRANCHES
Waits for all upstream branches, then passes their outputs downstream as one object
| Field | Value |
|---|---|
type | FLOW |
icon | fa-solid fa-code-merge |
Object If Condition
ID OBJECT_IF_CONDITION
Routes an object through a true or false output
| Field | Value |
|---|---|
type | FLOW |
icon | fa-solid fa-code-branch |
Run workflow
ID RUN_WORKFLOW
Run's another workflow with this workflow's input data
| Field | Value |
|---|---|
type | ACTION |
icon | fa-solid fa-code-branch |
List count condition
ID LIST_COUNT_CONDITION
Check whether the number of elements in a list satisfies a condition
| Field | Value |
|---|---|
type | FLOW |
icon | fa-solid fa-code-branch |
Object Action Trigger
ID OBJECT_ACTION
Triggers a workflow when a user clicks a button on a particular object.
| Field | Value |
|---|---|
type | TRIGGER |
icon | fa-solid fa-bolt |
