Examples of using smart values with lists
Some fields contain more than one option (e.g. checkboxes, Labels, Multi-selects, Multi-user picker...) You can use smart values to access these fields as well using a number of convenient methods we've added for working with lists - available in our reference section.
Let's go through a few examples - say you have a multi checkbox called 'Sydney Attractions' and it has three options:
- Harbour Bridge
- Opera House
- Bondi Beach
There are a number of different ways to render this list of values:
// Simplest way to show a comma separated list of values
{{issue.Sydney Attractions.value}}
Harbour Bridge, Opera House, Bondi Beach
// Display attractions separated with a dash
{{#issue.Sydney attractions}} {{value}}{{^last}}- {{/}}{{/}}
Harbour Bridge - Opera House - Bondi Beach
// Now separated by space
{{#issue.Sydney attractions}}{{value}} {{/}}
Harbour Bridge Opera House Bondi Beach
// OR
{{issue.Sydney attractions.value.join(" ")}}
Harbour Bridge Opera House Bondi Beach
These type of fields use .value
to access the human readable label (you can also access .id
):
- Select lists
- Multi select lists
- Cascading select lists
- Radio buttons
- Multi checkboxes
Multi-user pickers
Multi-user pickers work in the same way as other multi fields except that you have full access to all of the user's attributes (e.g. .displayName
).
Say we have an "Aussie actors" multi-user picker with:
- Hugh Jackman
- Nicole Kidman
- Eric Bana
You could then use these smart values to access this picker:
// Simply show their names
{{issue.Aussie actors.displayName}}
Hugh Jackman, Nicole Kidman, Eric Bana
// Simply show their names
{{#issue.Aussie actors}}{{displayName}} ({{emailAddress}}) {{/}}
Hugh Jackman (hugh@wolf.com) Nicole Kidman (kid@nicole.com) Eric Bana (wog@aussie.com)