Skip to main content
OnCommand Workflow Automation 5.1

Create a command

Contributors

You can create a WFA command to complete a specific task in your workflow if there is no predefined WFA command that is suitable for the task.

What you'll need

You must know how to write the required code for the command using either PowerShell or Perl.

Steps
  1. Click Workflow Design > Commands.

  2. Click New icon on the toolbar.

  3. In the Properties tab of the New Command Definition dialog box, enter or select the required details in the Name, Description, and Timeout fields.

    1. In the String Representation field, enter a string representation for the command using MVEL syntax.

      VolumeName + "=>" + SnapshotName

      The string representation for a command is used to display the information you want to see in the workflow design during planning and execution. You must use only the parameters of the command in string representation for a command.

    2. Optional: If you are creating a wait command, select Wait for condition in the Command type section, and set the required value in the Waiting interval (s) field.

  4. In the Code tab, perform the following steps:

    1. Select the required scripting language for the command from the Script Language list.

      You can click + and select an additional language for the command.

    2. Enter the appropriate code for the command in the selected language tab.

      If you want to use password type for user inputs in the PowerShell script, you must create an alias for the parameter and include _Password in the attribute. For Perl script, you can specify the type as Password in the Parameters Definition tab.

      Note The following special characters are not supported in the command editor: "<", "&amp", and XML tags "< >".
      param (
        [parameter(Mandatory=$false, HelpMessage="Specify an AD administrator password.")]
        [Alias("ADAdminPassword_Password")]  [string]$ADAdminPassword
      )
  5. In the Parameters Definition tab, perform the following steps:

    1. Click Discover Parameters to populate the parameters definition table.

      The parameters and their attributes are extracted from the code and displayed in the table. For example, the Array and VolumeName parameters are extracted from the following code:

      param (
        [parameter(Mandatory=$true, HelpMessage="Array name or IP address")]
        [string]$Array,
      
        [parameter(Mandatory=$true, HelpMessage="Volume name")]
        [string]$VolumeName,
      )
    2. Click the description column of the parameters to edit the description.

      You cannot edit any other field in this tab.

  6. In the Parameters Mapping tab, perform the following steps for each parameter:

    1. From the Type column, select the appropriate dictionary object.

    2. In the Attribute column, enter or select the appropriate attributes for the dictionary object from the list.

      After entering an attribute, you can enter a period (.) and include another attribute of that object.

      Enter cm_storage.volume as type and aggregate.name as the attribute for the AggregateName parameter.

    3. In the Object Name column, enter an object name.

      The object name is used for grouping the parameters under a tab in the Parameters for <command> dialog box when you are specifying the command details in a workflow.

    The unmapped parameters are displayed in the Other parameters tab of the Parameters for <command> dialog box when you are specifying the command details in a workflow.

  7. In the Reservation tab, enter a reservation script using SQL queries to reserve the resources that are required by the command during a scheduled workflow execution:

    1. Optional: In the Reservation Representation field, enter a string representation for the reservation using MVEL syntax.

      `"Add rule for SnapMirror label `

      " + SnapMirrorLabel + "[.code] to the SnapMirror policy `

      " + PolicyName + "`"

      The string representation is used to display the details of the resources reserved in the Reservations window.

    Note The reservation script must not perform any operation on databases except the cm_storage, cm_performance, storage, performance, vc, and custom schemes.
  8. Optional: In the Verification tab, enter an SQL query to verify whether the command has affected the data sources and the WFA cache as expected so that the reservation can be removed.

    The SQL query that you enter can only consist of SQL SELECT statements.

    1. Click Test Verification to test the verification script.

    2. In the Verification dialog box, enter the required test parameters.

    3. If you do not want to use the reservation data to test the verification script, clear the Use *reservation data in test field.

    4. Click Test.

    5. After reviewing the test result, close the dialog box.

  9. Click Test to test the command.

  10. In the Testing Command <command name> dialog box, click Test.

    The result of the test is displayed in the Log messages section of the dialog box.

  11. Click Save.