Versions Compared

Key

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

...

How to format JIRA fields?

A: Depending on the field type you have the following options: 

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

...

#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:

...

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:

Code Block
titleEmail to Slack binding
linenumberstrue
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:

 

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