Using Workflow Modules

A workflow module is one or more ordered workflow steps that are configured and saved together as a single, reusable component.

You can't run modules by themselves; you must add them as a step in a workflow. To add a module as a step, the workflow type (that is, command, pre-provisioning/approval, completion workflow) and the target type of the module and the workflow must match.

As reusable components, workflow modules can enhance productivity — if you frequently use a common set of steps in your workflows, you can configure and save those steps as a module, then add the module to your workflows, as required, instead of recreating each step every time.

In this topic:

For information on how to export and import workflow modules, see Exporting and Importing Workflow Definitions.

Creating workflow modules

Access through:

Configuration > Command Workflows

Configuration > Self-Service > Approval tab

Configuration > Self-Service > Completion tab

Available to:

Commander Role of Superuser and Enterprise Admin

To create a workflow module:

  1. Click the Modules tab, then click Add.

    Tip: You can also select a workflow module in the list and click Copy. This option can save you time because it copies much of an existing workflow module's configuration.

  2. On the Name page of the Workflow Module Configuration dialog, do the following, then click Next:
    • Enter a name and a description for the workflow module.
    • Depending on the type of workflow you're creating the module for, you may have to select a target type or select when to apply the workflow.
  3. On the Input Variables page, optionally add one or more input variables that the module steps may use, then click Next.

    Input variables provide a way to pass information into module steps that the steps aren't able to access directly. This information could be return codes or output workflow steps that have already executed. Input variables are module-specific; if you create an input variable in one module, it won't be available in other modules. For an example of how to use input variables, see Example: Using a Module in a Workflow.

    • To add an input variable, click Add, then perform the following steps in the Input Variables dialog. You can add multiple input variables.
      1. In the Display Name field, enter a name for the input variable.
      2. In the Variable Name field, enter the name that will be used for the variable expression. For example, if you enter "usefulTestVariable", the resulting expression will be #{inputVariable['usefulTestVariable']}. See Variable Syntax for Emails and Scripts for basic variable syntax.
      3. In the Description field, provide a description to indicate the purpose of the input variable.
      4. If you want the variable to have a default value, enter it in the Default Value field.
      5. If an input variable is required to properly run a step in the module, enable Required. Users will be required to enter a value before saving the Workflow the module is added to.

        Note: When input variables in a module are modified, workflows that use those modules aren't automatically updated.

      6. Click OK.
    • To edit an existing input variable, select the variable, click Edit, modify the variable in the Input Variables dialog, then click OK.

      Note: If you modify an input variable, Commander won't automatically make the update in any workflows the module was already added to. In this scenario, you must go to each workflow and modify the module step that uses that input variable.

    • To remove an input variable, select a variable from the list, and click Delete.
  4. On the Steps page, click Add and select a step to include in the module, and then set its configuration parameters in the Step Details pane.

    When configuring steps, consider the following:

    • By default, steps execute automatically. If you want a step to execute only when specific conditions are met, select Step Execution > Execute when conditions are met, then click Edit and define the conditions. See Making Workflow Steps Conditional for more details.
    • Any input variables that you defined in the previous step will be listed here. Standard supported variables are also available.

    • By default, if a step fails when a workflow is run, no re-attempt to execute it will be made. If you want a workflow to re-attempt to execute a step if it fails, select the step, then click Add > Retry Selected Step. For more information, see Adding Retry Steps to Workflows.

    For details on built-in steps, see Workflow Steps Reference. For details on plug-in steps, see the readme files included with the plug-in step JAR files added to your system at <Commander_install_directory>\tomcat\wfplugins\. See Using Plug-In Workflow Steps.

  5. Continue to add steps to the workflow module, as appropriate, and click Next when you're done.

    Tip: To change the order of a step, use the up and down arrows, or click Delete to remove it.

  6. On the Summary page, enter details about the module in the Description of Changes field.

    For example, indicate the purpose of a new workflow module or, if you're editing an existing module, indicate the nature of the changes made.

  7. Review the module's configuration details, and click Finish when you're done.

Adding modules to workflows

You can add workflow modules to a workflow in the same basic manner as you add regular workflow steps.

Tip: To view which workflows a module has been added to, go to the Modules tab of the Completion, Approval, or Command Workflows pages. When you select a module, the details pane displays all of the workflows that the module has been added to. You can click the Edit link beside any workflow to edit that workflow.

Access through:

Configuration > Self-Service > Approval tab

Configuration > Self-Service > Completion tab

Configuration > Command Workflows

Available to:

Commander Role of Superuser and Enterprise Admin

To add a workflow module to a workflow:

  1. On the Steps page of one of the workflow configuration wizards, click Add > Run Module.

    Note: If a module includes input variables, and those variables will use input generated by other steps in the workflow, you must ensure that the module is placed after the steps that it's dependent upon.

  2. In the Run Module Step Details section, set the following parameters for the module:
    • Step Name: By default, a name of "Run Module" is used. You should edit the module's name to make it more specific and descriptive.
    • Step Execution: By default, a module executes automatically. To make the module conditional, so that it only executes if specific conditions are met, select Execute when conditions are met, click Edit and define the condition. See Making Workflow Steps Conditional for more details.
    • Workflow Module: Choose an existing workflow module.
    • Input Variables: If input variables were added for the module (as described above), they will be listed here. For each variable, provide a value that will be input to the module step. The values can be static string values (for example, "Requested resource change approved" could be input for the body of an approval email). They could also be variable expressions that will add data generated by steps that are before the module in the workflow (for example, "#{steps[1].output}" will add the output of Step 1 to the input variable in the module step). For basic syntax, see Variable Syntax for Emails and Scripts.
  3. Continue to add steps and modules, and when you've finished, click Next.
  4. Continue to configure the workflow, as required.

    For more information, see:

Deleting workflow modules

You can delete a workflow module if it isn't used as a step in any workflows in your local Commander installation. If a workflow module is used in workflows in your local Commander installation, you must first remove the module from all of the steps in those workflows.

Access through:

Configuration > Command Workflows

Configuration > Self-Service > Approval tab

Configuration > Self-Service > Completion tab

Available to:

Commander Role of Superuser and Enterprise Admin

To delete a workflow module:

  1. Click the Modules tab.
  2. Select a listed workflow module.
  3. Click Delete and confirm the deletion.