Versions Compared

Key

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

One of the most typical use cases for notification is when status is transitioning from A to B, say "To Do" to "In Progress". Here's a small example on how to catch this and send a message to your users::

 

No Format
#foreach ($issue in $issues)
  #foreach ($item in $issue.lastchange.items)
    #if ($item.fromString == "To Do" && $item.toString == "In Progress")
        Issue $issue.key status is chagned to In Progress
    #end
  #end
#end

 

Note the use of pseudo-field "lastchange" here. This is an array of "items" that were changed during the last update to JIRA issue.

So we iterate through that list and see if there's a change to field called "status" and transition must be from "Open" to "In Progress". Only if we find such item then the content between "fields" will be rendered.

Remember, that Raley Notifications doesn't send out empty messages, so if there were no status changes with the issue, the above-mentioned script will evaluate to empty string and no message to user is sent.