BloomERP

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.

SettingTypeDefaultDescription
idstrRequiredStable node ID stored in workflows.
documentationstr''Markdown and tagged examples included in the generated developer reference.
typeLiteral['ACTION', 'FLOW', 'TRIGGER']RequiredCategory for the editor and execution engine, validated during registration.
namestrRequiredName shown in the workflow editor.
descriptionstrRequiredSummary of the node's behavior.
executor_clsOptional[Type[BaseExecutor]]NoneExecutor class that provides configuration, data contracts, ports, and execution.
iconOptional[str]NoneIcon 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.

python
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.

python
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

FieldValue
typeTRIGGER
iconfa-solid fa-circle-plus

On Object Update

ID ON_OBJECT_UPDATE

Triggered when an object is updated

FieldValue
typeTRIGGER
iconfa-solid fa-pen-to-square

On Object Create or Update

ID ON_OBJECT_CREATE_OR_UPDATE

Triggered when an object is created or updated

FieldValue
typeTRIGGER
iconfa-solid fa-arrows-rotate

On Object Deletion

ID ON_OBJECT_DELETE

Triggered when an object is deleted

FieldValue
typeTRIGGER
iconfa-solid fa-trash-can

On Schedule

ID SCHEDULE

Triggered on a defined schedule

FieldValue
typeTRIGGER
iconfa-solid fa-clock

Human Trigger

ID HUMAN_TRIGGER

Triggered by a human. Used for testing purposes.

FieldValue
typeTRIGGER
iconfa-solid fa-hand-pointer

Send Email

ID SEND_EMAIL

Sends an email to specified recipients

FieldValue
typeACTION
iconfa-solid fa-envelope

Get Object

ID GET_OBJECT

Get a specific object by ID

FieldValue
typeACTION
iconfa-solid fa-database

Create Object

ID CREATE_OBJECT

Creates a new object in the database

FieldValue
typeACTION
iconfa-solid fa-database

Update Object

ID UPDATE_OBJECT

Updates an existing object in the database

FieldValue
typeACTION
iconfa-solid fa-pen

Delete Object

ID DELETE_OBJECT

Delete an existing object in the database

FieldValue
typeACTION
iconfa-solid fa-trash

Enrich Data

ID ENRICH_DATA

Enriches the input data with additional fields

FieldValue
typeACTION
iconfa-solid fa-magic

Extract Field

ID EXTRACT_FIELD

Extracts a field from the incoming value

FieldValue
typeACTION
iconfa-solid fa-code

Call API

ID CALL_API

Makes an external API call

FieldValue
typeACTION
iconfa-solid fa-cloud-arrow-up

List Objects

ID LIST_OBJECTS

List different objects

FieldValue
typeACTION
iconfa-solid fa-list

Send User Message

ID SEND_USER_MESSAGE

Send a message to a user

FieldValue
typeACTION
iconfa-solid fa-message

Generate PDF

ID GENERATE_PDF

Generate a pdf from a document template

FieldValue
typeACTION
iconfa fa-file-pdf

SQL Query

ID SQL_QUERY

Execute a raw SQL query against the database

FieldValue
typeACTION
iconfa-solid fa-database

Compute

ID COMPUTE

Compute a value using a custom Python function

FieldValue
typeACTION
iconfa-solid fa-calculator

Human in the Loop

ID HUMAN_IN_THE_LOOP

Pauses the workflow and waits for a human to provide input

FieldValue
typeACTION
iconfa-solid fa-hand-paper

Wait

ID WAIT

Pauses the workflow for a certain amount of seconds

FieldValue
typeACTION
iconfa-solid fa-clock

If Condition

ID IF_CONDITION

Routes input through a true or false output

FieldValue
typeFLOW
iconfa-solid fa-code-branch

Filter Objects

ID FILTER_OBJECTS

Filters a collection of objects based on field values

FieldValue
typeFLOW
iconfa-solid fa-filter

For Each

ID FOR_EACH

Runs the downstream branch once for each item in a collection

FieldValue
typeFLOW
iconfa-solid fa-repeat

Collect

ID COLLECT

Collects all results from a For Each into one ordered list

FieldValue
typeFLOW
iconfa-solid fa-layer-group

Merge Branches

ID MERGE_BRANCHES

Waits for all upstream branches, then passes their outputs downstream as one object

FieldValue
typeFLOW
iconfa-solid fa-code-merge

Object If Condition

ID OBJECT_IF_CONDITION

Routes an object through a true or false output

FieldValue
typeFLOW
iconfa-solid fa-code-branch

Run workflow

ID RUN_WORKFLOW

Run's another workflow with this workflow's input data

FieldValue
typeACTION
iconfa-solid fa-code-branch

List count condition

ID LIST_COUNT_CONDITION

Check whether the number of elements in a list satisfies a condition

FieldValue
typeFLOW
iconfa-solid fa-code-branch

Object Action Trigger

ID OBJECT_ACTION

Triggers a workflow when a user clicks a button on a particular object.

FieldValue
typeTRIGGER
iconfa-solid fa-bolt