What do I need to get started with Raley Notifications?

If you're in the Cloud version then you will need:


Cloud JIRA will normally use account with username  addon_net.vacom.jirassimo to interact with your host instance. If there are any access-related errors you can tune it by giving extra permissions to 

addon_net.vacom.jirassimo user


If you're using JIRA Server then:

Templating is difficult... Do you provide example templates?

Yes, please have a look here: Predefined Email Notification templates


How to format JIRA fields?


DateTime fields

By default, JIRA json is returning datetime fields in the following form: 2015-12-10T14:25:20.374+1100 which is fine for computers, but hard to read for humans. With Raley templates you can use a dedicated function to format JIRA dates using the format you prefer.


We use ISO 8601 format for displaying dates. For mor information, refer to https://en.wikipedia.org/wiki/ISO_8601

Here's an example of datetime formatting:

#foreach ($issue in $issues)
 Project: $issue.fields.project.name Issue type: $issue.fields.issuetype.name
 Date and time of creation: $jirassimo.formatDate($issue.fields.created, "dd MMM yy hh:mm")
 Reporter: $issue.fields.reporter.name
#end

Numeric fields

To format a numeric JIRA field use $jirassimo.formatNumber(numberField, outputFormat) function. An example of usage:

$jirassimo.formatNumber($issue.customfield_12345, "#")

Assuming that customfield_12345 contains a value 10.45 the result will be 10. We use Java DecimalFormat to format the values. 


How to use Settings?

Settings is essentially a map of key=value pairs stored with Raley. At runtime you can get a value referenced by key using the following expression:

$jirassimo.settingValue($issue.fields.customfield_10000)

This will return a setting's value that corresponds to key stored in $issue.fields.customfield_10000


Sending to different Slack channels depending on user's email

Sometimes you need to send a message to email or Slack channel but the address is not directly specified in the JIRA issue. Instead, you need to resolve it by some key be it username, team name etc. In situations like this you will need to use Settings, which are technically just a properties map of key=value pairs:

me@dot.com=#general
you@dot.com=#technical
somebody@dot.com=#marketing
...

And in your template you just need to resolve a value from settings based on the key at hand. It is as simple as:


#foreach ($issue in $issues)
    $jirassimo.settingValue($issue.fields.customfield_10000)
#end


How to use custom scheduled event?

This is another name for scheduled messagingThe whole idea here is that Raley will not react on specific events in your host JIRA, but rather poll it at specific times and send messages about issues that are relevant to JQL.

To save your time, here're the most popular CRON expressions that you might find useful while configuring your own messenger:

Expression
Explanation
0 0 10 ? * MON-FRIRun daily from Monday to Friday at 10AM
0 0 9 1/1 * ? *Run daily at 9AM
0 0 12 1/1 * ? *Run daily at 12AM


Our messaging system is implemented in such a way that at the beginning of every hour it checks all custom scheduled messengers to understand which of them are eligible to run during this hour. If specific messenger is eligible, then it will be run right away. You should keep in mind that since messengers are run hourly, then it doesn't make sense to use a CRON expression like this (running messenger every 10 minutes): 

0 0/10 * 1/1 * ? *

If you still do, the corresponding messenger will still run only once per hour.


How are run-time errors reported?

Each messenger might return an error generated at runtime. Examples of this errors are:

These errors would be normally reported to user on the list of Raley notifications just below the names of respective messengers. When you fix it, assuming that the fix was correct, the error message will disappear next time the current messenger is successfully run.



How to group issues by status

If you want your scheduled messenger to display Jira issues grouped by their current status then:

a) Make sure that your JQL rule does select issues in all desired statuses. For example, if you need statuses "To Do", "In Progress" and "Done" in project XYZ, then use the following JQL:

project = XYZ and status in ("To Do", "In Progress", "Done") order by status

b) In your message template use #if statement to check for status of issue

Issues in status To Do <br/>
<table border=1>
    <tr>
       <th>key</th>
       <th>summary</th>
       <th>assignee email</th> 
    </tr>
    #foreach ($issue in $issues)   
       #if ($issue.fields.status.name == "To Do")   
          <tr>
             <td>$issue.key</td>
             <td>$issue.fields.summary</td>
             <td>$!issue.fields.assignee.emailAddress </td>
          </tr>
       #end
    #end
</table>


<br/><br/>
Issues in status In Progress <br/>
<table border=1>
    <tr>
       <th>key</th>
       <th>summary</th>
       <th>assignee email</th> 
    </tr>
    #foreach ($issue in $issues)   
       #if ($issue.fields.status.name == "In Progress")   
          <tr>
             <td>$issue.key</td>
             <td>$issue.fields.summary</td>
             <td>$!issue.fields.assignee.emailAddress </td>
          </tr>
       #end
    #end
</table>


<br/><br/>
Issues in status Done <br/>
<table border=1>
    <tr>
       <th>key</th>
       <th>summary</th>
       <th>assignee email</th> 
    </tr>
    #foreach ($issue in $issues)   
       #if ($issue.fields.status.name == "Done")   
          <tr>
             <td>$issue.key</td>
             <td>$issue.fields.summary</td>
             <td>$!issue.fields.assignee.emailAddress </td>
          </tr>
       #end
    #end
</table>