> For the complete documentation index, see [llms.txt](https://doc.duaer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/Duaer-Organizations/sub-Duaer-Organization-conversion.md).

# Convert to sub-workflows in Duaer

In Duaer, select nodes in your workflow and convert them into a sub-workflow.
Use conversion to refactor a workflow into reusable parts. Expressions that reference other nodes are updated automatically and added as parameters on the Execute Workflow Trigger.

## Selecting nodes for a sub-workflow <a href="#selecting-nodes-for-a-sub-organization" id="selecting-nodes-for-a-sub-organization"></a>

The selection must be continuous and must connect to the rest of the workflow from at most one start node and one end node. It must also:

- Exclude trigger nodes.
- Allow at most one node outside the selection to connect in. That node may have several incoming connections, but only a single input branch (not a Merge). It must not take connections from nodes inside the selection.
- Allow at most one node outside the selection to connect out. That node may have several outgoing connections, but only a single output branch (not an If). It must not connect back into the selection.
- Include every node on the path between the input and output nodes.

## How to convert part of a workflow <a href="#how-to-convert-part-of-a-digital-organization" id="how-to-convert-part-of-a-digital-organization"></a>

1. Select the nodes on the canvas.
2. Right-click the canvas background and select Convert to sub-workflow.

Duaer creates a workflow, moves the selected nodes into it, and places an Execute Workflow Trigger at the start. On the original canvas, that stretch becomes the node that calls the sub-workflow.

## Things to keep in mind <a href="#things-to-keep-in-mind" id="things-to-keep-in-mind"></a>

- Set input and output type constraints yourself. By default both allow all types. Set expected types on the Execute Workflow Trigger and, when present, the Edit Fields node labeled Return.
- Limited support for AI sub-nodes: select them all, and duplicate any model sub-node still shared with nodes outside the selection.
- New sub-workflows use v1 execution order regardless of the parent setting. You can change that in Settings.
- Expressions using first(), last(), or all() may gain suffixes such as _firstItem, _lastItem, or _allItems. Open the node and check.
- itemMatching requires a fixed index. An index computed by an expression is not converted.
## Questions

### What does conversion require?

In Duaer, the selection must be continuous, exclude triggers, and connect outside through at most one single-input entry and one single-output exit. A Merge cannot be the entry. An If cannot be the exit. Every node on the path must be selected.

### What happens to expressions after conversion?

In Duaer, expressions that pointed outside the selection are rewritten to the Execute Workflow Trigger input. You set input and output types yourself. first/last/all may gain suffixes such as _firstItem; check the nodes.

## Related

- [Work with nodes in Duaer](https://doc.duaer.com/Duaer-Organizations/components/nodes.md)
- [Connect nodes in Duaer](https://doc.duaer.com/Duaer-Organizations/components/connections.md)
- [How items link across Duaer nodes](https://doc.duaer.com/data/data-mapping/data-item-linking.md)

