The **Workflow** node allows you to trigger another workflow from within your current workflow. This makes it possible to break complex processes into smaller, reusable workflows, improving modularity and maintainability.
The **Workflow** node is ideal for enterprise automation where processes need to be standardized, reusable, and easy to manage. For example, you could trigger an invoice processing workflow from an order management workflow, or call a notification workflow after a task is completed.
The timeout for each workflow can be configured using the `WORKFLOW_TIMEOUT_SECONDS` environment variable. For more information checkout [Customizing Workflow Configuration](/docs/setup/env-vars#customizing-workflow-configuration).
For this example, the data that the child workflow receives is in the following format:
```js
{
"logged_by": "Authentication System",
"message": "New user created"
}
```
The child workflow receives the data and performs an insert operation to the database and returns a response based on the success of the insert operation.
For this example, the data that the parent workflow receives is in the following format:
```js
{
"email": "employee@org.com",
"name": "Employee",
"phone_number": "+1111111111"
}
```
1.**Create a DB Node to insert the data to the DB named `addEmployee`.**
2.**Branch the `addEmployee` node.**
Click the branch icon to branch the `addEmployee` node. From the green port, create an SMTP Node to send a success mail to the employee named `mailTheEmployee`.
From the red port, create a workflow node and name it `logFailure`.
3.**From the `mailTheEmployee` node, create a workflow node and name it `logSuccess`.**
4.**Configure the `logSuccess` and `logFailure` nodes.**
Both success and failure paths create a log entry, ensuring that the parent workflow’s actions are traceable.
### Example 2 - Build a Reusable Notification Workflow
Often, different workflows need to alert the right person when an incident occurs. To avoid repeating the same notification steps in every workflow, we can create one shared workflow for sending notifications.
For this example:
- The parent workflow deletes an S3 object and then calls the child workflow.
- The child workflow sends notifications.
- The parent workflow checks if the notification succeeded.
We add a node that deletes an object from S3 and name it `removeObjectFromAWSS3`. Then, from this node, we create an outgoing connection to a Run Workflow node named `notificationSystem`.
Here's the configuration for ```notificationSystem``` node. This follow the same format as given in child workflow:
<imgclassName="screenshot-full img-full"src="/img/workflows/nodes/wf/notification-system/notificationSystemNode.png"alt="Notification System node"/>
After the child workflow completes, we evaluate its response to determine whether the notification was successful. For this, we use an ```If Condition``` node named ```checkNotificationSuccess```, which checks:
```notificationSystem.data.success == true```
After running the workflow, we'll receive an email like this: