Create a command
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.
You must know how to write the required code for the command using either PowerShell or Perl.
-
Click Designer > Commands.
-
Click on the toolbar.
-
In the Properties tab of the New Command Definition dialog box, enter or select the required details in the Name, Description, and Timeout fields.
-
In the String Representation field, enter a string representation for the command using MVEL syntax.
Example
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.
-
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.
-
-
In the Code tab, perform the following steps:
-
Select the required scripting language for the command from the Script Language list.
You can click + and select an additional language for the command.
-
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.Example
param ( [parameter(Mandatory=$false, HelpMessage="Specify an AD administrator password.")] [Alias("ADAdminPassword_Password")] [string]$ADAdminPassword )
-
-
In the Parameters Definition tab, perform the following steps:
-
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
andVolumeName
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, )
-
Click the description column of the parameters to edit the description.
You cannot edit any other field in this tab.
-
-
In the Parameters Mapping tab, perform the following steps for each parameter:
-
From the Type column, select the appropriate dictionary object.
-
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.
Example
Enter
cm_storage.volume
as type andaggregate.name
as the attribute for theAggregateName
parameter. -
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.
-
-
Optional: 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:
-
In the Reservation Representation field, enter a string representation for the reservation using MVEL syntax.
Example
"Add rule for SnapMirror label
" + SnapMirrorLabel + "to the SnapMirror policy
" + PolicyName + "`"`The string representation is used to display the details of the resources reserved in the Reservations window.
The reservation script must not perform any operation on databases except the cm_storage, cm_performance, storage, performance, vc, and custom schemes. -
-
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.
-
Click Test Verification to test the verification script.
-
In the Verification dialog box, enter the required test parameters.
-
If you do not want to use the reservation data to test the verification script, clear the Use reservation data in test field.
-
Click Test.
-
After reviewing the test result, close the dialog box.
-
-
Click Test to test the command.
-
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.
-
Click Save.