Description:
This step dynamically constructs the workflow as a sub-workflow.
Inputs
- definitionID – definition to instantiate from
- passVariablesToChild – passes variable values from parent to child instance. Make sure, the child instance has the same variables, named exactly same as the parent variables.
- passVariablesBackToParent – passes the variables values back to the parent from the child instance
- passGlobalsToChild – pass Globals to child instance
- passGlobalsBackToParent – pass Globals back to the parent from the child instance
- dynamicKeys -- dynamic keys to process
- childKeyVariableName -- dynamic key variables
- isSynched – Yes = parent waits until child instance is completed to execute, No = parent instance does not wait for the child instance to complete, parent instance keeps executing
- pcvarmap – parent to child variable mapping
- pcglobalmap – parent to child global mapping
- cpvarmap – child to parent variable mapping
- cpglobalmap – child to parent global mapping
Returns
- True – step executed successfully
- False – step failed to execute
Usage:

Example:
Let’s build and execute the “dynamicSubworkflowDef” example, passing variables or globals to sub-workflows and back.
- Create a new Form Definition named “dynamicSubworkflowDef” and open it in designer mode.
- Drag a “BootstrapGrid, File, and Submit” control to the canvas and arrange them as shown below.

- Click the “File” control to configure its properties. Provide a name for the control. Specify the file extensions to accept. Set the maximum DB file size. Select the “Required” checkbox for mandatory user input. Select the “Hide” checkbox to hide the control at runtime. Select the “Read-Only” checkbox to mark the control as read-only. Select the “Multiple” checkbox to allow multiple files to be attached. Select the “Show” checkbox to display the list of attached files. Select the “Allow” checkbox to enable downloading files when the control is marked as read-only. Click the Save button.

- Create a new process definition named “dynamicSubworkflowDef” and open it in designer mode.
- Drag “updateVariable, updateGlobals, getFileAttachments, dynamicSubWorkflow” steps to the canvas.
- Connect the dots between the “Start” and other steps, as shown below.

- Click the “updateVariables” step to configure its “Optional” properties. Provide a variable reference and value as shown below. Select “Has Expression” as “Yes” if the variable value is an expression—for example, TODAY().

- Click the “updateGlobals” step to configure its “Optional” properties. Click the button to configure multiple globals and values. Click the Add Row (+) button to insert an empty row. Enter a global name and value as shown below. Add more rows to map additional global names and values. Click the Save button to confirm changes. Select “Has Expression” as Yes if the variable value is an expression such as TODAY(). Click the Save button.

- Click the “getFileAttachments” step to configure its “Required” properties. Provide a name for the step. Provide a variable or global reference to hold the form instance ID, the file attachment path, and the file attachment file name. Click the Save button. Note: Click the "AI Predict" button to have Copilot add new process steps that match your process description.

- Click the “getFileAttachments” step to configure its “Optional” properties. Select the form definition from the drop-down list. Click the button to map the file control ID from the form. Click the Add Row (+) button to insert an empty row. Select the appropriate File Control ID from the form. Click the Save button to confirm the changes. Select the File List format from the options (blank, XML, or JSON). Click the Save button.

- Click the “dynamicSubWorkflow” step to configure its “Required” properties. Select the process definition to use. Provide dynamic keys and variables for processing. Here, the count of file attachments is treated as a dynamic key-value pair, and a variable used to track iterations is treated as a dynamic key variable. Click the Save button. Note: Click the "AI Predict" button to have Copilot add new process steps that match your process description.

- Click the “dynamicSubWorkflow” step to configure its “Optional” properties. Select “Yes” to pass variables to the child instance. Select “Yes” to pass variables back to the parent instance. Select “Yes” to pass globals to the child instance. Select “Yes” to pass globals back to the parent instance. Select 'Yes' to synchronize workflow execution between parent and child instances. Selecting “No” makes the process executions mutually independent. Click the Save button.

- Click the button to map variables between parent and child instances. A configuration pop-up window appears. Click the Add Row (+) button to insert an empty row. Provide the variable-to-value mapping below. Click the Save button. You may add multiple variable mappings using the Add Row button.

- Click the button to map the globals between parent and child instances. A pop-up window appears for configuration. Click the Add Row (+) button to insert an empty row. Enter the global and value mapping as shown below. Click the Save button. You may add multiple global mappings using the Add Row button.

- Click the button to map variables between child and parent instances. A pop-up window appears for configuration. Click the Add Row (+) button to insert an empty row. Provide the variable-to-value mapping below. Click the Save button. You may add multiple variable mappings by using the Add Row button. Note: You can map sub-process globals to parent process variables when you need to swap values between globals and variables.

- Click the button to map globals between child and parent instances. A pop-up window appears for configuration. Click the Add Row (+) button to insert an empty row. Enter the global and value mappings as shown below. Click the Save button. You can add multiple child-to-parent global mappings by using the Add Row button. Note: Configurations for passing variables/globals from the parent workflow to the child and back at runtime are optional. You can map sub-process variables to parent process globals when you need to swap values between globals and variables.

- Create another process definition named “BooleanDef” for use by the “dynamicSubworkflow” step, and open the definition in designer mode.
- Drag the “updateVariables, updateGlobals, decision, and placeHolder” steps to the canvas.
- Connect the dots between the “Start” and other steps, as shown below.

- Click the “updateVariables” step to configure its “Optional” properties. Provide a variable reference and store a value as shown below. Select “Has Expression” as “Yes” if the variable value is an expression such as TODAY(). Click the Save button.

- Click the “updateGlobals” step to configure its “Optional” properties. Click the button to configure multiple globals and values. Click the Add Row (+) button to insert an empty row. Enter a global name and value as shown below. Add more rows to map additional global names and values. Click the Save button to confirm changes. Select “Has Expression” as “Yes” if the variable value is an expression such as TODAY(). Click the Save button.

- Click the “decision” step to configure its “Required” properties. Provide a name for the step and a condition to evaluate. Then click the Save button. Note: Click the "AI Predict" button to have Copilot add new process steps that match your process description.

- Let's instantiate a new process by executing the Form. To do this, navigate to the Form-Definition page. Select the Form definition “dynamicsubworkflowDef” above. Click the “View - Execute With Params” menu option.

- On the “Configure Execute Params” page, the Form definition is already selected. Next, select the process definition from the drop-down list. Use the buttons to choose whether to store the form instance ID in variables, globals, or form variables. Select the language to render the Form from the drop-down list. Select the checkbox and choose the user from the drop-down list for test mode execution.

- A Form Instance is created and rendered in a new tab. In this example, three files are attached from local system folders. Click the Submit button to continue.

- The dynamic subprocess step executes the sub-workflow once for each file attachment on the form. In this example, the sub-workflow is executed three times.

Definition Sample:
You may download the sample definition(s) from the link provided and later import them (drag-and-drop) into your FlowWright Process Definition (XML file) or Form Definition (HTML file) page.
Note: Please verify and complete the process steps for any missing configurations, such as file path references and database connections, after the import. Then, save the definition to confirm the changes.
Click here to download the sample "dynamicSubworkflowDef" HTML file.
Click here to download the sample "dynamicSubworkflowDef" XML file.
Click here to download the sample "booleanDef" XML file.