Grab Clappia’s 50% OFF Black Friday Deal before it’s gone! Ends 05 Dec 2025.
View offer →
#bf-banner-text { text-transform: none !important; }
Table of Content
Still need help?
Request support
Request Support
Help
 / 
 / 
Workflows
 / 

Workflows: Database Workflow Node

This article explains the features and configurations of the Database Workflow Node, which allows you to fetch data dynamically from an external database and use the results within your workflows.

Select Database Type

Use Cases

  • Notification Workflow: Retrieve customer data like name and email, and send personalized notifications.
  • Inventory Management: Fetch current stock levels from the database and use them in workflows to generate alerts or orders.
  • Employee Updates: Pull specific employee details (e.g., department or designation) for HR workflows.
  • Report Generation: Retrieve data for generating and emailing summary reports.

Adding the Database Workflow Node

To include the Database Workflow Node in your workflow, click on ‘Add step’ or the ‘+’ symbol and select the node from the list.

Editing the Node

Click on the Database Workflow Node to configure the following fields in the right panel.

 Database Type

Step Name

The Step Name is used to identify the workflow node.

Example: Fetch Customer Data or Retrieve Inventory.

Select Database Type

Select Database Type

Choose the type of database you want to connect to from the dropdown menu.

Supported Options: MySQL, PostgreSQL, AzureSQL.

database

Database Host

Enter the hostname or IP address of your database server.

Example: database.company.com or 192.168.1.1.

Port

Specify the port number for your database connection.

Example: 3306 for MySQL or 5432 for PostgreSQL.

Username and Password

Provide the credentials for accessing the database. Ensure this account has read permissions for the required tables.

Database Name

Enter the exact name of the database where your data resides.

Example: employee_table.

Authenticate

Click on Authenticate to establish a connection with the database. Once authenticated, additional fields will appear for query configuration.

Query Configuration

Query Configuration

Once the connection is authenticated, configure the query and output fields to fetch the required data.

Database Query

Write an SQL query to fetch the desired data.

  • Example: SELECT * FROM employee_table;
  • Note: Use queries with filters to avoid fetching unnecessary data.

Output Fields

Output Fields

Define the column names from your database query as output fields.

  • These must match the column names exactly as they appear in the database.
  • Only the columns specified here will be fetched and available for further workflow nodes.

Example:

If your query is:

SELECT * FROM employee_table;

And your output fields are set as:

  • age
  • email

Only these two fields will be fetched and available for subsequent steps.

Using Output Fields in Other Workflow Nodes

Once the Database Workflow Node executes, output variables are generated based on the defined output fields. These variables can be used in subsequent nodes, such as Email Workflow Node, Approval Node, IF Node, etc.

To pull up any of the output variables from the Database workflow node, type in @ followed by the name of the node (if you haven’t changed the name, it will be database). You will see the output labels. Select the ones needed to pull up the output dynamically.

Example:
Example

Database Query:

SELECT * FROM employe_table WHERE employee_name = ‘{name}’;

Output Fields: age, email.

Here, employee_name is a column in the database table and {name} is a field in the Clappia app to capture the name of an employee.

Generated Variables which can be pulled by typing in @ followed by the workflow node name:

  1. {database#item_age}: Contains the age of the employee.
  2. {database#item_email}: Contains the email of the employee.

Using in Email Workflow Node:

Using in Email Workflow Node

Subject: Employee Update

Body:

Hello,

This is Employee Age: {database#item_age}

Employee Email: {database#item_email}

This email will dynamically fetch the age and email for the employee retrieved in the query.

Other Options

Parent Step

Define the parent step for the node. This ensures the node is executed only after its parent step completes.

Enable This Step

Toggle this option to enable or disable the workflow step. Disabling a step skips its execution during the workflow.

Note on Workflows and Bulk Operations

Workflows in Clappia run on individual submissions, such as when a user submits or manually edits a record. However, when using Bulk Upload or Bulk Edit from the Submissions tab, workflows are not triggered, even though new submissions may be added or existing ones updated.

This is because workflows are designed to process one submission at a time. Triggering them for bulk operations can lead to incomplete or inconsistent results, especially for complex workflows.

If you need workflows to run after a bulk operation, currently you will need to open each submission manually and save it. This will count as an edit and trigger the workflow normally.

FAQs
What happens if my database query returns multiple rows?

If the query returns multiple rows and the next step directly uses the database variables, only the first row’s values will be used.

If you need to process all returned records, you must add a Repeat Workflow after the Database Workflow. The Repeat will iterate through each row retrieved by the query, allowing you to perform actions.

For example, if your query retrieves five employee records and the next step is a Create Submission workflow that uses the database output variables, only the first employee’s data will be used to create a single submission. The remaining four records will not be processed.

If the intention is to create five separate submissions for each employee returned by the query, you must place a Repeat Workflow after the Database Workflow. The Repeat Workflow will execute the Create Submission step once for each row returned, ensuring all five records are processed.

What happens if the database is not reachable when the workflow runs?

If the database cannot be reached, the Database Workflow will fail because it cannot fetch the required data.

In this case, the workflow will move to the next step below, depending on how the workflow is structured. The database values will not be available for use in subsequent steps.

My query runs, but the output variables are empty. Why?

This usually happens when the query does not return any matching records.

For example, your app may have a field called Name, and that value is used inside the SQL query like this:

WHERE employee_name = '{name}'

Here, {name} refers to the value submitted in the Clappia form field when the workflow runs. If the submitted name does not match any record in the external database, the query will return no rows, and the output variables will remain empty.

Another common reason is that the column names listed under Output Fields do not exactly match the column names returned by the query. Output field names must match the database column names exactly. If they do not match, the system will not populate the variables.

Do I need to configure Database Integration under App Configuration before using this node?

No. The Database Workflow connects directly to the database using the credentials entered inside the node itself. It does not depend on the Database Integration setting under App Configuration.

The two features are separate. Database Integration pushes submission data to a database, whereas the Database Workflow fetches data during workflow execution.

Authentication was successful, but the workflow still fails when it runs. Why?

Authentication only confirms that the connection to the database is valid. It does not validate the SQL query itself.

If the workflow fails after authentication, check the SQL query for syntax errors, incorrect table names, incorrect column names, or filters that do not match the expected data format. These issues can cause the node to fail during execution.

What happens if my database query returns multiple rows?

The Database Workflow generates output variables based on the results of the query. If multiple rows are returned, the system will generate item-based variables accordingly.

It is recommended to use filters in your query to return only the specific record needed for the workflow. This helps avoid ambiguity and ensures that the correct data is used in later steps such as Email or Approval nodes.

Can other workflow steps use the database output variables in parallel branches?

Database output variables are available only after the Database Workflow has finished executing.

If another step attempts to use those variables before the Database Workflow completes, the values will be empty.

Ensure that the workflow is designed in a way that the Database Workflow executes before any step that depends on its output.

Why are the database output variables not appearing when I type @ in another workflow?

Output variables become available only after the Database Workflow has been configured properly. The connection must be authenticated, the query must be defined, and the Output Fields must be saved.

Also ensure that you are typing @ followed by the exact step name of the Database Workflow. If the step was renamed, you must use the updated name.

If the step is disabled, its variables will not be available during workflow execution.

Why are some columns from my query not available in later workflow steps?

Only the columns defined in the Output Fields section will be available for use in subsequent workflow nodes. Even if your SQL query selects all columns using SELECT *, you must still explicitly list the required column names under Output Fields.

If a column is not listed there, it will not be generated as a workflow variable.

Does the Database Workflow Node update or modify data in the database?
No. The Database Workflow is designed to fetch data from the database using a query. It does not perform insert, update, or delete operations. It retrieves data so that it can be used in other workflow steps.
Try our free plan
It will answer many more questions within just 15 minutes.