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.

To include the Database Workflow Node in your workflow, click on ‘Add step’ or the ‘+’ symbol and select the node from the list.
Click on the Database Workflow Node to configure the following fields in the right panel.

The Step Name is used to identify the workflow node.
Example: Fetch Customer Data or Retrieve Inventory.

Choose the type of database you want to connect to from the dropdown menu.
Supported Options: MySQL, PostgreSQL, AzureSQL.

Enter the hostname or IP address of your database server.
Example: database.company.com or 192.168.1.1.
Specify the port number for your database connection.
Example: 3306 for MySQL or 5432 for PostgreSQL.
Provide the credentials for accessing the database. Ensure this account has read permissions for the required tables.
Enter the exact name of the database where your data resides.
Example: employee_table.
Click on Authenticate to establish a connection with the database. Once authenticated, additional fields will appear for query configuration.

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

Define the column names from your database query as output fields.
Example:
If your query is:
SELECT * FROM employee_table;
And your output fields are set as:
Only these two fields will be fetched and available for subsequent steps.
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.

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:
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.
Define the parent step for the node. This ensures the node is executed only after its parent step completes.
Toggle this option to enable or disable the workflow step. Disabling a step skips its execution during the workflow.
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.
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.
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.
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.
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 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.
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.
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.
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.
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.
L374, 1st Floor, 5th Main Rd, Sector 6, HSR Layout, Bengaluru, Karnataka 560102, India
3500 S DuPont Hwy, Dover,
Kent 19901, Delaware, USA

3500 S DuPont Hwy, Dover,
Kent 19901, Delaware, USA
L374, 1st Floor, 5th Main Rd, Sector 6, HSR Layout, Bengaluru, Karnataka 560102, India

