Workflow Control – Trigger Workflow
Caution |
Test the script(s), processes and/or data file(s) thoroughly in a test environment, and customize them to meet the requirements of your organization before attempting to use it in a production capacity. (See the legal notice here) |
Note: The workflow sample mentioned in this article can be downloaded from the Opalis project on CodePlex: https://opalis.codeplex.com |
Overview
The Trigger Workflow Activity is used to start other Workflows. This allows for creating chained Workflow sequences. It also enables nesting of Workflows (see the Nested Workflows examples).
1. Parent Workflow
This Workflow uses the Trigger Workflow Activity to start the Workflow named ‘2. Child Workflow: Create File’. Once triggered, the Workflow continues to the next Workflow Activity as the ‘Wait for completion’ option is not set:
The next Trigger Workflow Activity starts the Workflow named ‘3. Child Workflow: Run Program’ and waits for it to complete until the Workflow continues. This is because the ‘Wait for completion’ option is set:
The Delete File Activity deletes the file that is created by the Workflow named ‘2. Child Workflow: Create File’:
2. Child Workflow: Create File
This Workflow uses an Append Line Activity to create a sample text file:
The sample text file is deleted in the last step of the Workflow named ‘1. Parent Workflow’.
3. Child Workflow: Run Program
This Workflow uses a Run Program Activity to launch ‘Notepad’:
The program is launched as a background process which is the default behavior:
This Workflow will not complete until the ‘notepad.exe’ process ends. In this example the Windows Task Manager will be used to end the ‘notepad.exe’ process.
Running the example Workflows
- Launch the Workflow named ‘1. Parent Workflow’ by using Start or by running it using the Operator Console.
- The Workflow named ‘2. Child Workflow: Create File’ will start and end.
- Next, the Workflow named ‘3. Child Workflow: Run Program’ will start:
- ‘1. Parent Workflow’ will stay running until ‘3. Child Workflow: Run Program’ completes.
- Use the Windows Task Manager to end the ‘notepad.exe’ process:
- ‘3. Child Workflow: Run Program’ completes.
- ‘1. Parent Workflow’ will continue and delete the sample text file before it ends.
Check the Opalis Designer log history or Testing Console log as well as the C: drive to see the results of this Workflow.
Launch the Workflow named ‘3. Rest Demo’ to perform cleanup.
More Information
Refer to the Trigger Policy Activity Online Help.
Share this post : |