Conditions are used in a wide variety of contexts in IssueNet and provide an enormous degree of flexibility in the types of rules they can be used to implement. Accordingly, complete documentation of the uses and types of conditions is beyond the scope of this article. However, there are patterns that many conditions used in notification rules follow. Understanding these common types of conditions will allow you to create the majority of notification rules you will want to implement.
For trigger based notifications the condition is the most crucial element since it is primarily responsible for determining when a notification action is executed. In most environments there are two typical types of notifications:
- Sending a notification when an item is created with a particular property. For example, managers want to receive notifications when issues with a priority of Urgent are submitted.
- Sending a notification when a property of an existing item has changed – typically from one specific value to another. For example, sending a notification to the assigned resource to a task when the assignment changes.
In both of these notification examples we only want to send the notification when a particular type of item is created or updated &ndash for example, an issue or task. If we create a rule that notifies based on priority value alone, it would notify based on both issues and tasks since both have a priority property. If you want to limit the notifications to a specific type of item, you need to add a statement to the condition that specifies the type of item, or class, the notification is to be sent about. To limit the notification to a specific item type we will start by adding a statement to a condition like the following:
If $(CurrentObject.ClassID) is kind of "dae296e5-b651-48ec-ad0a-6da360167384"
In this example we used the condition editor to specify that we want to identify a class by ID and then used the Class option in the Type box of the Value section to allow us to pick a class and have the editor fill in the GUID identifier. We also used the ?is kind of? operator in the Is box to specify that we wanted to use the object ID to check the type of class the item is. By doing this we limit the scope of the notification rule to a particular item type and its sub-types (classes). So, by picking issue as the class, this notification rule will apply to all issues and items that are members that are derived from issue. If we had picked the class ?defect? the notification rule would be specific to members of that class.
Now that we have added a statement to the condition to limit the type of item the notification rule will apply to, we want to add additional statement(s) to specify the properties we are interested in. As described above, there are two typical types of property information rules apply to:
- When an item has a particular property value &ndash For example, when an item is submitted with a priority of Urgent
- When an item has a property change &ndash For example, when the assigned resource of a task changes.
In both instances you want to start by adding a new statement to the condition. You want to use the default operator that joins the statement which is "AND".
To use a condition to determine if an item has a property you will want to create a condition like the following:
If $(CurrentObject.Priority) is equal to "Urgent"
This condition will determine if the current item has a priority of urgent. Other variables could be used to check different properties or properties of more specific items.
To use a condition to determine if a property has changed, you will want to use the :Current and :Original operators to compare values. To use a condition to determine if the assignment of a task changed you would want to add the following statement to your condition:
If $(WorkflowTask.AssignID:Original) is not equal to $(WorkflowTask.AssignID:Current)
This variable is created by adding the first conjunct using the If box, selecting Variable in the Value box and entering the second variable in the Variable box.
By taking advantage of the variable syntax for comparing current and original values, you can notify base on a change to any field &ndash including text fields such as and item’s description. You can also detect specific values changes. The following condition could be used to notify if an item’s priority has changed from Urgent to any other value except High. This kind of condition would allow managers to be notified about unusual priority changes.
If $(CurrentObject.Priority:Original) is equal to "Urgent" and $(CurrentObject.Priority:Current) is not equal to "High"
|