Description:
This step dynamically builds the workflow using a sub-workflow.
Inputs
- definitionID – definition to instantiate from
- dynamicKeys -- dynamic keys to process
- 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
- 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 and pass variables/globals to subworkflows and back.
- Create a new form definition called “dynamicSubworkflowDef”
- Select the definition and click the “design” button
- Drag BootstrapGrid, File and Submit controls to the canvas and arrange them as shown on the below graphic
- Click on the “File” control to configure its properties. Save the form definition
- Create a new process definition called “dynamicSubworkflowDef”
- Select the definition and click the “design” button
- Drag and connect the process steps as below
- Click the “updateVariables” step to configure its “Advanced” properties. Provide a variable reference and store a value as below. Select “Has Expression” as Yes if the variable value is an expression like TODAY()
- Click the “updateGlobals” step to configure its “Advanced” properties. Click the button to configure multiple globals and values. Click the Add Row (+) button to insert an empty row. Provide a global name and value as below. Add more rows to map multiple global names and values. Click on the Save button to confirm changes. Select “Has Expression” as Yes if the variable value is an expression like TODAY().
- Click the “getFileAttachments” step to configure its “Settings” properties. Provide a name to the step. Provide the variable/global reference to hold the form instance ID, store the file attachment path, and file attachment file name.
- Click the “getFileAttachments” step to configure its “Advanced” properties. Select the form definition from the drop-down list. Click the button to provide a mapping of 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 between a blank, XML, and JSON options. Click the Save button to confirm the step configuration changes.
- Click the “dynamicSubWorkflow” step to configure its “Advanced” properties. Select the workflow definition from the drop-down list. 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 the globals back to the parent instance. Provide dynamic keys and variables to process. Here, the count of file attachments is considered as dynamic key value, and a variable to keep count of the iterations is considered as dynamic key variable. Select Yes to Synchronize the workflow execution between parent and child instances. By selecting the NO option, the workflow executions are mutually independent.
- Click the button to map the variables between parent and child instances. Click the Add Row (+) button to insert an empty row. Provide the variable and value mapping as below. Add a row to insert multiple parent-to-child variable mappings. Click the Save button to confirm.
- Click the button to map the globals between parent and child instances. Click the Add Row (+) button to insert an empty row. Provide the global and value mapping as below. Add a row to insert multiple parent-to-child global mappings. Click the Save button to confirm.
- Click the button to map the variables between child and parent instances. Click the Add Row (+) button to insert an empty row. Provide the variable and value mapping as below. Add a row to insert multiple child-to-parent variable mappings. Click the Save button to confirm.
- Click the button to map the globals between child and parent instances. Click the Add Row (+) button to insert an empty row. Provide the global and value mapping as below. Add a row to insert multiple child-to-parent global mappings. Click the Save button to confirm. NOTE: The configurations to pass variables/globals from parent workflow to child and back during run time are optional.
- Create another process definition called “BooleanDef” to be used by the “dynamicSubworkflow” step.
- Select the definition and click the “design” button
- Drag and connect the process steps as below
- Click the “updateVariables” step to configure its “Advanced” properties. Provide a variable reference and store a value as below. Select “Has Expression” as Yes if the variable value is an expression like TODAY()
- Click the “updateGlobals” step to configure its “Advanced” properties. Click the button to configure multiple globals and values. Click the Add Row (+) button to insert an empty row. Provide a global name and value as below. Add more rows to map multiple global names and values. Click on the Save button to confirm changes. Select “Has Expression” as Yes if the variable value is an expression like TODAY().
- Click on the “decision” step to configure its “Settings” properties. Provide a name to the step. Provide a condition to evaluate. Click the Save button to confirm the changes.
- Let's instantiate a new process by executing the form. To do this, you must navigate to the Create - Form Definition page. Select the above form definition “dynamicsubworkflowDef.” Click on the View - Execute With Params menu option
- On the Configure Execute Params page, the form definition is already selected. Next, you must choose the process definition from the drop-down list. Use the buttons to select between variables, globals, and form variables to store the form instance ID. 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 the local system folders. Click the SUBMIT button to continue.
- The dynamic subprocess step executes the sub-workflow as many times the file attachments are counted on the form. In this example, the sub-workflow is repeated three times.
Definition Sample:
You may download the sample definition(s) from the link here and later import it (drag-drop) to 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 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.