Launching an Email Task Based on a Task Monitor
From OpsWise Documentation Wiki
In this exercise, we will set up a Task Monitor and Task Monitor trigger. The Task Monitor will monitor all tasks for a status that indicates some sort of problem. When the trigger is satisfied, the system will launch an Email task that notifies a user that there is a problem. We will also create an Email template for use in our Email task and create an Activity screen filter that displays only problem tasks.
The following illustration shows the various components used to trigger tasks based on the status of other tasks.
Contents |
Creating an Activity Screen Filter
The first task we will do is create a filter for the Activity screen that will be used by our imaginary tech support person. When this user receives an email indicating there is a problem, he or she can view this Activity screen to find out more information. In OpsWise Automation Center, this filter is referred to as a report. For more detailed explanations of each field, see Reports.
- From the Navigation pane, select Automation Center > Reports. The main report screen displays.
This screen provides a list of all reports that your userid has access to, along with a New button that allows you to create a new report. - Under My Saved reports, click New. A blank reports screen displays.
- In the Name field, enter "Problem Task Instances".
- In the Visible to field, select Everyone.
- In the Type field, select List.
- In the Table field, select Activity[ops_exec], which is the table used for all Activity reports and contains information about all task activity.
- Skip the Group by field.
- In the Filter and Order fields, click the plus (+) sign and select the following:
- In --choose field -- select, Status
- In the operator field, select is one of.
- In the last field, use CTRL+Click to select all of: Undeliverable, Running/Problems, In Doubt, Start Failure, Cancelled, Failed.
- The Columns section displays a list of available fields in the Available section, and the selected fields in the Selected section. A number of default fields appear in the Selected section. For this tutorial, move the following fields to the Selected list in the order shown:
- Status
- Type
- Instance Name
- Invoked By
- Start Time
- End Time
- On the Selected list, double click fields to remove them from the report.
- On the Available list, double click fields to add them to the report.
- To save the report, click Save.
Now we will open a new tab containing only our new Activity screen:
- Open a new browser tab.
- From the first tab, click and drag the Activity option to the new tab.
- Click the new tab. Note that the new tab contains only the Activity screen, without the navigation pane and other application options.
- Click the scroll bar at the top that shows the current report name.
- Select the report you just created, Problem Task Instances. Your Activity screen will now show only problem task instances, sorted by status (the leftmost column).
Creating an Email Template
Email Templates allow you to create a "canned" Email task that you can then refer to when creating an Email task. This is useful if you have a large number of common parameters on Email tasks but still require separate tasks.
- From the navigation pane, select Resources > Email Templates.
- For Template Name, type Notification based on status.
- For Email Connection, select the connection you defined for earlier exercises.
- For the To field, enter a usable email account that you can use for the tutorial.
- For Subject, type:
- For Body, enter
- Click Submit. Your Email Template should resemble the sample shown below.
Task failure alert
Task failure, see Problem Report Activity screen
Creating an Email Task Using an Email Template
- From the navigation pane, select Tasks > Email Tasks and click New.
- In the Task Name field, type Triggered by Task Status.
- In the Email Template field, select the Email Template you just created, Notification based on status. For our purposes, we will leave the remaining fields blank since we want to use the information from the template. If you fill in any of the duplicate fields, the information from the task overrides the information from the template.
- Click Submit.
Creating the Task Monitor Task
For this Task Monitor, we will monitor the status of all other tasks. If any task has a status that indicates there is some sort of problem, we will generate an email. Once the Task Monitor is launched by the Task Monitor trigger, it remains active, launching an email every time any of its conditions are met. The Task Monitor task remains active until the Task Monitor trigger is disabled or until a user manually stops it.
- From the navigation pane, select Tasks > Task Monitors, and click New.
- In the Task Name field, type Monitors for Problems.
- In the Status area, enable the following statuses: Undeliverable, Running/Problems, In Doubt, Start Failure, Cancelled, Failed. Hint: For a description of each status, see Task Status Descriptions.
- In Monitoring Type, select General Tasks. Note that you can also select Specific Task and browse for a task name.
- In Task type to Monitor, we will leave all task types selected for our exercise.
- Click Submit.
Creating the Task Monitor Trigger
As the last step in our setup process, we will create the Task Monitor trigger, which controls when the Task Monitor task is started and stopped.
- From the navigation pane, select Triggers > Task Monitor Triggers and click New.
- In Trigger Name, type Controls Monitors for Problems.
- In the Task Monitor field, browse to the Task Monitor task you just created (Monitors for Problems).
- In the Tasks field, click on the lock icon and type a T in the browse field. This will jump to a list of tasks whose names begin with "T". Hint: Click here for more information about selecting records.
- Select Triggered by Task Status, which you created earlier.
- Click the down-arrow and select Save.
- Click Enable Trigger.
Running the Task Monitor
To test our setup, we need to run a task to one of the failure statuses that will trigger the email. To do so, we will launch the Manual task we created earlier and force it into Failed status.
- From the navigation pane, select Tasks > Manual Tasks.
- Right-click on the Pause for Manual task and select Launch Task.
- Display the Activity screen with the Today's Task Instances by Created Times filter.
- First note that the Monitor for Problems task is running. It was launched when you enabled the trigger.
- Locate the Pause for Manual task instance, which will be in Action Required status.
- Right-click on Pause for Manual. This displays a list of commands that are currently available for this task instance.
- Select Cancel. Pause for Manual goes to Cancelled status and an Email task is launched by the Task Monitor trigger.
- Check the email account where you sent the notification.
- Once the user receives the email, he or she can quickly check for more information by looking at the Activity screen using the Problem Task Instances filter and clicking on the Instance Name of the problem task. As shown in the illustration below, additional information about the issue is displayed in the Status Description field.
Hint: To view the status description and other information about a workflow instance, use Task Instances > All Task Instances.
For additional information, see:
- Email Task (user documentation)
- Email Resource (user documentation)
- Email Template(user documentation)
- Reports (user documentation)
- Activity Table (user documentation)
- Activity Screen (user documentation)
- Task Monitor Task (user documentation)
- Task Monitor Trigger(user documentation)
- Command Quick Reference (user documentation)
- Cancelling a Task Run (user documentation)
- Modifying Activity Screen Reports (2 minute movie)












