Tasks are used to automate previously manual processes and provide monitoring capabilities. Think of a Task as a script built, stored and executed from a central repository.
Step 1. Create the Task
In the right-side menu, select Automate, then from the top menu, select Tasks > Manage Tasks.
Click on the Create button, and then enter a unique Task Code and Name.
Suggestion for Task Code and Name respectively:
The Description field is helpful but optional.
The Task Editor is split approximately 30/70 between the toolbox on the left and the editor on the right.
The toolbox contains several tabs organizing information about the Task.
Click on the Commands tab to display the different Task commands available.
Step 2. Add a Command
The left side of the Commands tab is a list of command categories. Select the
Interactcategory, and a list of commands appears to the right.
Drag and Drop the Log Message command from the toolbox to the editor on the right. Immediately a text box appears.
Enter the following text:
Changes made on a Step are immediately saved when the focus leaves a field. Click elsewhere or tab out of the text field to save.
Step 3. Run the Task
Now let's run this Task. Click on the
Run tab in the toolbox and then click the
Run button. A confirmation dialog will appear - on the right pane click the
Run Now button. The Task Run Log will appear. If the task instance is not already Complete, click the refresh button. This first Task shouldn't take more than a few seconds to complete.
Commands toolbox tab again, but this time choose the
Variable category. Find
Set Variables and drag this command above the
Log Message command.
In the Variable box enter
"var1" and in the value box put the value
"Citizens of the".
+ sign below the Variable input box to add another variable. In the variable and value fields, enter
", we are taking over!!!" respectively. On the end, change the modifier drop down to UPPERCASE.
Now in the Log Message text box, change the message to the following:
Hello [$var1$] World [$var2$]
Run the Task again and observe the different output.
This is an example of how variable substitution is done in Tasks. The
$] esacpe syntax tells the Task Engine to attempt variable substitution at runtime.
Tasks can accept parameters that are to be passed in during runtime. The parameters can be set by humans during a manual Task launch, outside or third party processes, Deploy templates or even other Tasks. Using parameters has the advantage of creating reusable Task code that can be changed during runtime.
Create a parameter, go to the
Parameters tab and click
Add New. The parameter edit box will popup. This is more detailed explanation on the parameters options on this documentation site, but for the purposes of this tutorial we will keep it simple. Add the name
param1 and click the
Add button. Repeat this step for another parameter named
Referencing parameters in Task steps is done in the exact same way as regular variables. In the Log Message step, add [$param1$] and [$param2$] to the end of the message.
Go ahead and run the Task as you did before. You will be prompted for the parameter values, fill in any text that you would like. When the Task runs the new message will appear.