Skip to main content

Setting Up a Sub-workflow Group

A sub-workflow group is set up in the workflow builder, on the parent template. Users who hold Create Workflow Templates or Edit Workflow Templates add a Sub Workflow Node in Group mode, say which child workflows it starts, and add a Collect Sub-workflow Results step that waits for them. For what a group does when it runs, see Sub-workflow Groups.

Before you start​

Each child workflow is an ordinary workflow template. Check it before a group uses it:

  • It ends with a Complete Workflow step. A group child finishes only there. The builder does not save a parent whose group uses a workflow without one. See A child workflow without a Complete Workflow step.
  • It has an Output Node where the parent needs a label. A Collect step's label conditions, and a group that counts only some labels, read the label an Output Node recorded. Put the Output Node and the Complete Workflow step on the same reply.

The group's settings​

Configure group on the Sub Workflow node opens Sub Workflow group. Its first part, Group settings, applies to every child the step starts.

Sub Workflow group: Group settings with Deadline (hours) 48, When a child fails Continue the parent and A child counts when It completes; the entry Electrical on the parent's document, running SWG EN Trade check (child)

Sub Workflow group

SettingDescription
Deadline (hours)Children still running this many hours after the group starts are timed out. Leave it blank for no deadline.
When a child failsFail the parent (the default) or Continue the parent. Cancelling the parent always cancels its open children.
A child counts whenIt completes, or It ends with one of these labels. Only an Output Node records a label, so with labels, each child workflow needs one.

The card's summary follows these settings: Deadline shows the hours, and When a child fails shows the choice.

Spawn entries​

The second part, Spawn entries, lists the entries. Each entry starts its own children. A new step has one entry. Add entry adds another, and the remove icon on an entry removes it with everything set on it.

SettingDescription
NameNames the entry. It is shown on the entry, in the Inbox, and in the start dialog when the initiator chooses its workflow.
Only whenTicked, the entry is used only when the parent's document meets the conditions set on the entry.
StartHow many children the entry starts. See How many children.
Each child works onThe document each child runs on. See Child document.
Which workflowHow the child's workflow is chosen. See Choosing the child workflow.
Let the initiator choose the workflowThe person who starts the parent chooses the child's workflow. See Letting the initiator choose.
When nothing matchesWhat happens when no workflow is chosen, for example Start no child.
When a workflow is inactiveWhat happens when the chosen workflow is disabled, for example Try the next option.
Subject Template (under Each child)Each child's subject. It can read the parent's document fields, and the grid row or attachment the child is for.
Visibility (under Each child)Visible or Hidden. A hidden child never appears on anyone's lists, so it should not wait for a person.
Add input (under Each child)The values each child starts with. Each value is a template over the parent's document.

How many children​

StartChildren started
One childOne.
One per grid rowOne for each row of a grid on the parent's document. Only some rows starts one only for the rows that meet the conditions.
One per attachmentOne for each attachment of the parent's document.
One per document in the transmittalOne for each document listed in the parent's transmittal.

Child document​

Each child works onDescription
The parent's documentEvery child runs on the parent's own document. The entry says that isolation between children cannot be guaranteed.
A new documentEach child gets a new document, with the Document type, Title and Custom field values set here. The title and the values are templates over the parent's document. File the new document in is No folder or The workflow private folder, which System Config sets. See System Config.
Its attachmentWith One per attachment: each child runs on its attachment.
Its listed documentWith One per document in the transmittal: each child runs on its listed document.

Choosing the child workflow​

Which workflow has four choices.

ChoiceThe child runs
Always the sameThe Workflow Template chosen.
Chosen by rulesThe workflow of the first rule the parent's document matches, or the one under Otherwise.
Named in a fieldThe workflow named in a field of the document, or in a start input of the parent workflow.
Best match for the documentThe workflow from a list or a workflow group that best fits the document's project and document type.

Chosen by rules​

Each rule has conditions under Use this rule when, and the Workflow Template it runs. + Add Rule adds a rule; add at least one. Otherwise is the workflow started when no rule matches.

Which workflow Chosen by rules: Rule 1, Document.Doc Type Equals Report, runs SWG EN Check for Report; Otherwise SWG EN Check for any document

Chosen by rules

Test on a rule opens Test rules. Enter a Document reference number and select Run test. Each rule shows whether it matched, for example Matched, and the result names the workflow the child would run: "The child would run "SWG EN Check for Report"." Nothing is started.

Test rules: Rule 1 for SWG EN Check for Report Matched, and the child would run SWG EN Check for Report

Test rules

Best match for the document​

Pick from is A workflow group, or Chosen workflows listed under Workflows to pick from. The document's project says where the document's project is read from, for example Its project, else its legacy project field.

Which workflow Best match for the document: Pick from Chosen workflows, with SWG EN Check for any document, Check for Report and Check for Procedure, and The document's project

Best match for the document

Each child runs the workflow that best fits the parent's document: one for its project and document type first, then one for its project, then one for its document type, then one for neither. Of two equally good matches, the one listed first runs.

Test opens Test template selection. Enter a document's reference number and select Run test. It shows the document's project and document type, and lists the Ranked workflows: the one that Runs, any other that fits but ranks lower (Match), and why another was passed over, such as Another document type. Nothing is started.

Test template selection: SWG EN Check for Report runs; SWG EN Check for Procedure is passed over for another document type

Test template selection

Letting the initiator choose​

Tick Let the initiator choose the workflow, and list the Allowed workflows. The choice is Asked when the workflow starts: the start dialog has a field named after the entry, and the person who starts the workflow chooses one of the allowed workflows. Only the allowed workflows can be chosen. Left empty, the choice above decides.

Let the initiator choose the workflow, Asked when the workflow starts, with SWG EN Alternate check (child) allowed

Let the initiator choose the workflow

For the start dialog, see Testing and Launching Workflows.

Collecting the results​

Add Collect on the Sub Workflow node adds a Collect Sub-workflow Results step joined to Spawned, and is not shown once the group has one. The parent waits at the Collect step until the children have ended. Configure on the step opens its settings.

Collect Sub-workflow Results settings: an outcome route When Any child has the label, Label Failed, Output name Rework; Which children count; Documents and fields

Collect Sub-workflow Results settings

SettingDescription
Outcome routesAdd route adds a route. Each route has a condition (When), the value the condition needs, such as a Label, and an Output name, which becomes an output of the step. The names end, start and none_completed are reserved.
A child counts when (under Which children count)The group's rule (the default), It completes, or It ends with one of these labels.
Collect every kind of documentTicked (the default), the step collects every kind of document. Unticked, it collects only the Kinds of document to collect, which start as New documents and Attachments.
Result fieldsFields read from each child's document, by key or dotted path, for example po.total.

A route's condition can be:

  • Any child has the label or Every child has the label: the labels the children's Output Node steps recorded.
  • Any child failed, Any child timed out or Any child was cancelled.
  • Fewer children completed than: a number.
Collect Sub-workflow Results step with the outputs Done, Rework and None completed

Collect Sub-workflow Results step with a route

The parent continues down the first route whose condition matches. With no match, it continues down Done. When no child counts, it continues down None completed. For the node's reference, see Collect Sub-workflow Results Node.

To file or attach the documents the children made, add an Attach Documents step after the Collect step. See Attach Documents.

A child workflow without a Complete Workflow step​

A group child finishes only at a Complete Workflow step. When an entry runs a workflow that has none, the entry says so, and Save Workflow is disabled. Its tooltip names the workflow and the step, for example: "Cannot save: "SWG EN Check without Complete Workflow (child)", used by the Sub Workflow Node, has no "Complete Workflow" step. Choose another workflow or add the step to it."

The entry's warning: SWG EN Check without Complete Workflow (child) has no Complete Workflow step

A child workflow without a Complete Workflow step

Add a Complete Workflow step to that workflow, or choose another.

How to set up a sub-workflow group​

StepDescription
1Open the parent template in the workflow builder, and drag a Sub Workflow Node onto the canvas. It starts in Group mode.
2Select Configure group. Under Group settings, set the deadline, what happens when a child fails, and which children count.
3Under Spawn entries, name the entry, choose how many children it starts, the document each works on, and the child workflow. Give the children a Subject Template. Add more entries if needed, then select Close.
4Select Add Collect. A Collect Sub-workflow Results step is joined to Spawned.
5Select Configure on the Collect step. Add an outcome route for each result the parent should act on, then close it.
6Connect None spawned, Done, None completed and each route's output to the steps that follow, and save the template.

Example: Setting up a sub-workflow group