In Raley, settings is essentially a map of key=value pairs stored with your installation. 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
Here's a couple of use-cases for which Settings are useful:
Maintaining a centralised list of emails to which notifications should not be sent
You may want to have a global list of emails and a project-specific list of emails that should not receive notifications. For example we want to make sure that john.smith@company.com will not receive a notification from project ABC and
annika.soerensham@organization.org will not receive notifications from project DEF. Additionally, we want that viktor.hovland@pga.pro would never receive a notification. Here's how you can define this in settings:
ignoreEmails.GLOBAL.viktor.hovland@pga.pro=viktor.hovland@pga.pro ignoreEmails.ABC.john.smith@company.com=john.smith@company.com ignoreEmails.DEF.annika.soerensham@organization.org=annika.soerensham@organization.org
And in notification configuration that's responsible for sending notification for project ABC you would write TO as freeform text in this way assuming that emails are taken from customfield_11100:
#foreach ($u in $!issue.fields.customfield_11100) #set($email = $jirassimo.settingValue("ignoreEmails.GLOBAL.$u.emailAddress")) #set($emailABC = $jirassimo.settingValue("ignoreEmails.ABC.$u.emailAddress")) #set($shouldIgnore = ($email eq $u.emailAddress)) #set($shouldIgnoreABC = ($emailABC eq $u.emailAddress)) #if (!$shouldIgnore && !$shouldIgnoreABC) $u.emailAddress, #end #end
The same code block would be written in notification configuration for project DEF, just replacing ABC → DEF
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
Another good example where Settings are handy is to send a Conditional Notification depending on the value chosen in a field