Workflow Activities - Access and Configure Activities

Table of Contents

Selecting an Activity

Activities are tasks which can be defined in a Workflow. Use the following steps to locate an activity and use it in your Workflow:

  1. In your Workflow window, go to the Activities pane.

    The Activities pane provides access to the activities used to design the Workflow. You can select an activity from the Activities node or look it up using the Search for Activities box.

  2. To use an activity in your Workflow, drag the activity from the Activities pane to the design area.
  3. Once moved to the design area, double-click the activity and rename it to represent the task you want to perform.

    For a comprehensive list of all available activities, see Available Built-In Activities.

Configuring Activity Properties

You can update the properties of an activity listed in the workflow design area to customize its behavior in the workflow process. The properties for an activity can be accessed as follows:
  • By clicking on the activity in the design area

    The activity properties are displayed below the workflow design area.

  • By right-clicking the activity and then clicking Properties

    The activity properties are displayed in a dialog box.

The following sections describe the steps to configure each activity property.

Setting General Properties

  1. From the workflow design area, right-click the activity and then click Properties.

    The activity property dialog box appears.

  2. Optional: In the Value column for the Display Name property, enter a name that represents the task the activity will perform.
  3. Optional: In the Value column for the Description property, enter the purpose of the activity.
  4. To restart the activity if the activity fails during the workflow execution, set the following properties:
    • In the Value column for the Maximum restarts property, enter the maximum number of restarts. Enter 0 if you do not want the activity to restart.
    • In the Value column for the Restart Interval (minutes) property, enter the interval (in minutes) between restarts.
    • To proceed to the next activity after the activity reaches the maximum number of restarts, in the Value column for the Continue after max restarts property, select true.

      This is useful if you have conditional transitions in your Workflow, for example, you send a failure email (see Setting Conditional Transitions for more information).

      If you want the Workflow to fail immediately, leave this property as false.

  5. To time out the activity, in the Value column for the Timeout (minutes) property, enter the maximum time (in minutes) that the activity should take to finish.

    When an activity is timed out, it is marked with the failed status.

  6. To prevent the activity from creating an attempt, in the Value column for the Skip creating attempt property, select true.

     Do this if you do not need detailed tracking information for the activity. If an activity attempt is not skipped, it is displayed on the Attempts tab of the Admin Job History Details dialog box. For information on viewing the Admin Job History dialog box, see Admin Job History.

  7. Click OK.

Specifying Activity Inputs

The inputs for an activity are defined in the Inputs tab of the activity properties. Each activity in the Workflow has its own set of inputs. To view the inputs available for an activity, see Available Built-In Activities.

Use the following steps to specify the input values for the CheckReady activity as an example. This activity checks if a client is accessible.

  1. From the workflow design area, right-click the activity and then click Properties.

    The activity property dialog box appears.

  2. Click the Inputs tab.
  3. For the client input, select or type the name of the client from the Value column.

    If you want to specify a variable, a java object or other expressions, see Setting Activity Values using Expressions for more information.

  4. For the reportType input, select the type of readiness report from the Value column e.g., Summary.
  5. Click OK.

Customizing Activity Inputs

Inputs for some activities can be customized.

When workflows are executed in the CommCell or used in the Web Console as forms, the input screen can be customized to make it easier for users to enter the input data. After an input is created, use the following steps to customize it:

  1. From the properties pane, click the Inputs tab.
  2. Click Customize to open the properties dialog box.
  3. From the left pane of the Inputs tab, select the input to customize.

    The right pane displays the options for the selected input.

  4. By default, the Type list shows the input type defined when the input was added. It can be changed by selecting a new value from the Type list.
  5. Enter a name in the Display Name box.

    This is the name users see when prompted to enter the input value during workflow execution. If a name is not entered, the input variable name is used.

  6. Enter a value in the Default box.

    The default value prepopulates the input field during workflow execution. If a default value is not set, the input field is blank.

    Note:

    • The default value for boolean input types must be entered as either true or false.
    • If values are added to the Possible Values box, only those values may be used for the Default box.
  7. Select a value from the Control Type list to define how the input field appears to a user during workflow execution.

    The Control Type list changes depending on the input type:

    Type Control Type
    string TEXTBOX, MULTILINE, DROPDOWN, RADIOBUTTON, CHECKBOX
    integer, double, float, long, short TEXTBOX, DROPDOWN, RADIOBUTTON, CHECKBOX
    boolean CHECKBOX
    date CALENDAR, DROPDOWN, RADIOBUTTON, CHECKBOX
    dateTime DATETIME_PICKER, DROPDOWN, RADIOBUTTON, CHECKBOX
    time TIME_PICKER, DROPDOWN, RADIOBUTTON, CHECKBOX
    XML TEXTBOX, MULTILINE
    Binary FILE_PICKER, TEXTBOX

    For information on FILE_PICKER, see Customizing Inputs Using the FILE_PICKER Control Type.

    <Other> Changes depending on what is selected as the <Other> input type.
  8. Select Optional, Required, or Read Only.

    Required fields are marked with an asterisk during workflow execution.

  9. Enter values in the Possible Values box to define the data for the following control types:
    • DROPDOWN: The possible values are listed inside the drop-down box. Users are limited to these values during workflow execution.
    • RADIOBUTTON: The possible values are used as labels for the radio buttons.
    • CHECKBOX: The possible values are used as labels for the check boxes. During workflow execution, users can select multiple possible values if Create as list was selected when the input was first added. Users can select one of the possible values if Create as list was not selected.

  10. Click OK.

Setting an OnStart Script

You can execute a script written in Java or JavaScript at the beginning of an activity, right after the activity input values are evaluated. You can validate the activity inputs before they are processed in the Workflow, giving you the chance to perform certain operations when the inputs are not valid (such as failing the activity with a Job Pending reason or calling out a failure email activity).

For example, the create user qcommand activity creates a CommCell user based on the input details provided by the user during execution. If you want this activity to fail the Workflow when the new user details are not valid, you can specify the script using the following steps.

  1. From the workflow design area, right-click the activity and then click Properties.

    The activity property dialog box appears.

  2. Click the OnStart Script tab.
  3. Enter the code to be used.

    Tip: Click Insert Variable to add variables as needed.

  4. Click OK.

Java Example

The following script sample checks whether the username and email values for a new account are valid. If these values were not provided, the Workflow fails.

Setting an OnComplete Script

You can execute a script written in Java or JavaScript at the end of an activity. You can verify the activity output before it continues to the next activity and trigger a specific operation in the script depending on the output.

For example, In the Execute activity, you have XML to associate a CommCell user to a user group. Both the user and user group values are provided during the workflow execution. If you want this activity to fail the Workflow when an error code is found in the XML output, you can specify the script using the following steps.

  1. From the workflow design area, right-click the activity and then click Properties.

    The activity property dialog box appears.

  2. Click the OnComplete Script tab.
  3. Enter the code to be used.

    Tip: Click Insert Variable to add variables as needed.

  4. Click OK.

Java Example

The following script sample checks if the XML executed with no error codes (exit code is not 0). If an error code is found, the Workflow fails.

Viewing Activity Outputs

Similar to the activity inputs, each activity in the Workflow has its own set of outputs. Activity outputs can be used as inputs for other activities.

Use the following steps to view the outputs for an activity:

  1. From the workflow design area, right-click the activity and then click Properties.

    The activity property dialog box appears.

  2. Click the Outputs tab.

    You can see the outputs for the activity.

Viewing Activity System Variables

All of the activities available in the Workflow have a set of system variables. These variables can be called by other activities in the Workflow. For example, one of the system variables tracks the activity status. The status variable can be used to trigger a specific condition in another activity.

Use the following steps to see the system variables of an activity:

  1. From the workflow design area, right-click the activity and then click Properties.

    The activity property dialog box appears.

  2. Click the System tab.

    The following variables are common for all the activities:

    • startTime: provides the date and time when the activity started to run.
    • endTime: provides the date and time when the activity finished to run.
    • status: provides the status of the activity after runtime. For example, the activity completes with a FAILED status.
    • timedOut: provides a boolean value (true/false) that tells if the activity was timed out or not.

Setting Activity Values Using Expressions

Expressions are input values which typically consist of a variable and/or a hard-coded value (integer or non-integer). The variable can be an activity output, a workflow input or a workflow variable. Hard-coded values can also be Java objects.

Some activities may require expressions as their input values. Decision and Switch are some of the activities that use this type of input.

The following sections describe the steps to define activity inputs using expressions.

Specifying a Variable along with a Hard-Coded Value

Consider the following example where the output of an activity is used as a variable to specify the input value of another activity:

You have a Workflow to check if specific clients in the CommCell are reachable. As part of the Workflow, you have a Decision activity which analyzes the results of the CheckReady activity, and which checks the client connectivity. To appropriately configure the Decision activity, you must specify the expression required by this activity, which will be based on the exit code output of the CheckReady activity:

  1. From the workflow design area, right-click the Decision activity and then click Properties.
  2. Click the Inputs tab and then click in the Value box.
  3. For the expressions value, click Insert Variable and select exit code variable of the CheckReady activity from the dialog box. When added, it may look like this in the Value column:

    xpath:{/workflow/CheckReady_2/exitCode}

  4. To make the expression represent the successful scenario of the CheckReady activity, the exit code variable must be equal to 0. Therefore, you must type == 0 next to the exit code variable in the Value column:

    xpath:{/workflow/CheckReady_2/exitCode} == 0

Specifying Java or JavaScript Code

In addition to assigning variables and values for an activity input, you can write code in Java or JavaScript to obtain the value for the activity input. You can also write code to to perform validation checks on the activity input.

Code can be entered into all activities when surrounded by the following tags:

  • Java: opening java:{ and closing }:java tags
  • JavaScript: opening js:{ and closing }:js tags

Some activities do not require the tags. Java and JavaScript can be entered into the following activities without using the tags:

  • Script Activity
  • Transition Conditions
  • OnEnter/OnComplete Scripts
  • Decision

Procedure

  1. From the workflow design area, right-click the Activity and then click Properties.
  2. Click the Inputs tab.
  3. From the Value column of the activity input, click <Edit...>.

  4. Specify the Java or JavaScript code in the input dialog box and click OK.

Java Example

An activity takes a library entity object as an input, and the ID of the library is stored in a workflow variable. You can obtain the library entity value for the activity by using Java code. The following code gets the library entity for the activity using the workflow variable where the library ID is stored:

#Java Code Sample

java:{
commvault.msgs.CvEntities.LibraryEntity libraryEntity = new commvault.msgs.CvEntities.LibraryEntity();
libraryEntity.setLibraryId(xpath:{/workflow/variables/libraryId});
activity.library = libraryEntity;
}:java

JavaScript Example

The GET Client Properties REST API was accessed using the HttpClient activity. If you want to retrieve the client name from the JSON response, type the following script:

var response = JSON.parse(xpath:{/workflow/HttpClient_3/output});
var clName = response.clientProperties[0].client.clientEntity.clientName;

Assigning the Output of the Previous Activity as Input

When the output of an activity matches the input of the following activity, you can easily assign the output as the activity input. For example, if the output of an activity is a client computer which is expected as input for the following activity, you can quickly assign the value as follows:

  1. From the workflow design area, right-click the activity expecting the output of the previous activity. Then, click Properties.
  2. Click the Inputs tab.
  3. Place your cursor in the Value column for the input that requires output the previous activity.
  4. Click the Assign button.

    The output of the previous activity is entered in the Value column.

Automatically Assign Activity Inputs

You can setup the Workflow window to automatically assign inputs for an activity recently added to the flow using the output of the previous activity, whenever the output of the last activity matches the input value of the new activity. Aside from this, you can also set to automatically define the activity input as a workflow input or workflow variable.

  1. From the toolbar menu of your Workflow window, click Settings.
  2. Click the Automatically assign activity inputs on connect check box.

    If you want to automatically turn the activity input into a workflow input or variable, select Automatically create workflow inputs or Automatically create workflow variables based on your choice.

Creating a Workflow Input or Variable from an Activity Input

You can quickly convert an activity input into a workflow input or variable. The following steps will create a workflow input based on the client input of the CheckReady activity as an example:

  1. From the workflow design area, right-click the CheckReady activity and then click Properties.
  2. Click the Inputs tab.
  3. Select the client input, then right-click the input and click Workflow Input.

    A new Workflow input will be created and automatically assigned as the value of the client input.

Configuring Activity Connectors

Activity connectors are directional arrows in the Workflow diagram which specify the order of the activities in the Workflow.

You can update the properties of an activity connector in the workflow design area. Unless some conditions need to be specified, you are not required to configure its properties as most connectors play the role of indicating the next activity to be executed.

The properties for an activity connector can be accessed as follows:

  • By selecting the connector. The activity connector properties are displayed below the workflow design area.
  • By right-clicking the connector and then clicking Properties. The activity connector properties are displayed in a dialog box.

The following sections describe the steps to configure activity connectors.

Setting the Start and End Points

By default, when you drag an activity to the design area, a new connector will automatically appear pointing from the last activity to the recently added activity. If you want to connect the new activity with a different one in the Workflow, then do the following:

  1. Delete the connector using the Delete key in your keyboard.
  2. Click the center of the preceding activity and pull a new connector to point to the new activity as shown below.

Setting Conditional Transitions

You can configure the properties of an activity connector if you want to specify conditional paths in the Workflow.

Use the following steps to set conditions for a connector using the 'true' or 'false' condition as an example:

  1. From the workflow design area, right-click the connecting arrow and then click Properties.
  2. For the Display Name property, specify the name of the condition in the Value column.

    For example, the name can be "success" if this condition represents the success scenario.

  3. Based on the previous activity, set the condition for the connector:
    Previous Activity Property Value Example
    Decision Execute when condition is To follow this condition when the Decision expression evaluates to false, select false as the value.
    Switch Execute when condition is The value of the expression that the Switch activity evaluates to. See Setting Activity Values using Expressions.  
    Default You can set a default transition if the conditional value returns false.  
    Other Execute if previous activity status is To continue to the next activity when the previous activity executed successfully, select Successful as the value.
  4. If your connectors starts from an activities other than the Decision or Switch activity and you want to use Java or JavaScript to specify expressions to determine the activity transition, click the Condition tab.

    The expression in the Condition tab must return a Boolean value. To refer to the previous activity, use the activity variable.

    In the following example, the expression fails the Workflows if the previous activity did not complete successfully:

    activity.exitCode != 0;

    Note: The Condition tab is not available for activity connectors that start from a Decision or Switch activity because the condition is specified in the activity itself.

  5. Click OK.