Speedy Set Document State Node icon

Speedy Set Document State Node

speedy Set Document State Node for setting the document status

Overview

The Speedy Set Document State Node is designed to update the status of a document in a database by executing a stored procedure call. It is useful in workflows where document lifecycle management is required, such as tracking document progress through various states like "In Work," "Filed," or "Released." This node allows users to programmatically change the state of a document and add comments related to the status change.

Practical examples:

  • Automatically marking documents as "Reviewed" after an approval step.
  • Setting documents to "Locked" when they are no longer editable.
  • Adding comments during status transitions for audit trails.

Properties

Name Meaning
Dokumentennummer The document number for which the properties (status) are needed. Note: No data is generated if status changes to "Freigegeben" (Released).
Status The status to assign to the document. Options include: In Arbeit (2), Abgelegt (4), Freigegeben (8), Prüfung beantragt (128), Geprüft (256), Gesperrt (1014).
Kommentar A comment describing the reason or context for the status change.

Output

The node outputs JSON data representing the results of the SQL query execution that sets the document state. The output structure is an array of JSON objects corresponding to each input item processed. Each object contains the result of the stored procedure call that updates the document's status.

No binary data output is produced by this node.

Dependencies

  • Requires access to a MySQL-compatible database where the stored procedure n8n_SetDocState is defined.
  • Reads configuration from a JSON file (speedy_config.json) and an INI file specified within it, which provide default database connection parameters.
  • Needs valid database credentials (host, user, password, database name, port) either from input data or from the configuration files.
  • Uses the MySQL Node.js client library to connect and execute queries.

Troubleshooting

  • Common issues:

    • Missing or incorrect database connection details can cause connection failures.
    • If the document number (docno) or status (state) is not provided, the node will skip processing that item.
    • The stored procedure n8n_SetDocState must exist and be accessible with the provided credentials; otherwise, SQL errors will occur.
    • Status changes to "Freigegeben" (Released) do not generate data, so no output may be seen for those cases.
  • Error messages:

    • "Error executing SQL query:" indicates a failure in running the stored procedure or SQL command. Check database connectivity, permissions, and the correctness of the SQL syntax.
    • Connection errors usually relate to invalid host, port, user, or password settings.
  • Resolution tips:

    • Verify all database credentials and ensure the database server is reachable.
    • Confirm the stored procedure n8n_SetDocState exists and works as expected outside n8n.
    • Ensure input items contain valid docno and state values.
    • Review logs for detailed error messages.

Links and References

Discussion