Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Very often (60% of all One of the most popular use-cases to be precise) you want to receive a notification when

  • Status is changed from A to B
  • Issue priority is changed from A to B
  • Another Issue standard or custom field is changed from A to B

 

With Raley notifications you can receive this notifications, it just requires some configuring. Your starting point is to create a new messenger with

JIRA Event:    issue updated

JQL rule:       project = YOUR_PROJECT_KEY

The second condition is not mandatory, but highly recommended to keep things under control in scope of a single project.

 

Now we need to create a message template that will notify your user about the change in XXX. Remember the "most important rule" in Raley notifications:

If message template evaluates to empty then no message will be sent out

This is exactly what we need to make sure that messages will be sent only when they match predefined condition in our template, but how do we write a condition properly, so that it will be non empty when the respective field is changed and empty for all other issue updated events? As usually, picture is better than thousands of words, so here you go:

Image Removed

There are two sections of Issue fields code. In the top we describe a condition by checking first if $issue.last_change field exist. If so, we're iterating all $issue.last_change.items that were changed. And if the $item.field equals to "Status" then we render the message. Here's the source code for you convenience.

for Raley Notification is sending a message when a particular field in issue is changed. 

The screenshot below shows how to configure a notification that triggers when Priority And/Or Assignee is changed.

Image Added


It is possible to even further customise the condition when notification fires by adding extra conditions to JQL rule.

For instance, if we want to make sure that the notification is triggered only for issues in sprints that are currently open, you can specify JQL rule as

sprint in openSprints()


You can also impose a fine-grained controls on the actual values of the fields changed to make decision whether to fire the notification. For example, if we want to notify only when Priority value is High or Highest, then you can

use the following expression in your Template:

Code Block
linenumberstrue
    
Code Block
#foreach ($issue in $issues)
    #if ($issue.last_change)
         #foreach ($item in $issue.last_change$!issue.lastchange.items) 
       #if ($item.toString ==    #if ("High" or $item.fieldtoString == "StatusHighest")
 
          This issue has High or Highest priority. HerePlease comestake the message that renders only when Status is changed
 
immediate action!
             #end 
         #end 
    #end 
#end 

So far, so good, but let's say you need to track the Status change from "In Progress" to "Done". For that, we need to track two variables "fromString" and "toString" like in the following example:


And the final example demonstrates on how to make notification work only for user whose email is joed@company.com and priority was changed from Low to Medium:

Code Block
linenumberstrue
    
Code Block
#foreach ($issue in $issues)
    #if ($issue.last_change)
         #foreach ($item in $issue.last_change$!issue.lastchange.items) 
             #if ($item.fieldfromString == "StatusLow" and $item.fromStringtoString == "In ProgressMedium" and $item.toString$issue.fields.assignee.emailAddress == "Donejoed@company.com")
          Joe, this issue has increased    Here comes the messagepriority. thatPlease renderstake onlyhave when Status is changed from In Progress to Done
      a look!
       #end
         #end
    #end
#end

As you can see from the examples above, it all boils down to checking value of $item.field and optionally $item.fromString and $item.toString if you need more fine-grained control. But how would you know precise value of $item.field to compare against? There's a simple way to do that. Just change the field you're interested in in your testing issue and open that issue in Raley Notifications fields navigator as shown below:

Image Removed

...