|Sub Main(ByVal K2 As EscalationActionContext) |
' Meaning for K2.ActivityInstance.Priority
' 0 = High
' 1 = Medium
' 2 = Low
' Is this the first time this escalation fires?
' We know this is the first time because the initial
' value for the FeedbackPriority
' DataField is set to -1
If K2.ProcessInstance.DataFields.Item("FeedbackPriority").Value <> "-1" Then
' By decreasing the priority integer value every time,
' the escalation action fires, the priority
' increases from ‘Low’ to ‘Medium’ to ‘High’.
If K2.ActivityInstance.Priority > 0 Then
K2.ActivityInstance.Priority -= 1
' Store the new priority property in a process-level data field
K2.ProcessInstance.DataFields.Item("FeedbackPriority").Value = _
If K2.ActivityInstance.Priority = 0 Then
' Once the activity has reached a "High" priority,
' let’s expire this activity and
' continue with the process along the ‘High Priority’ path
' NOTE: This escalation was set to fire at most,
' three times, meaning, fire the escalation
' after 10 seconds and then repeating it two times
' thereafter (every 10 seconds).
Private Function GetPriorityText(ByVal Priority As Integer)
Select Case Priority
Case 0 : Return "High"
Case 1 : Return "Medium"
Case 2 : Return "Low"