Say I have a checkbox field or multi select field (e.g. called 'Equipment') and I want to show a list of all selected values in a comment that's being added, what's the correct Smart Fields syntax for this?
This does not work:
{{issue.fields.Equipment}}
I would like this to print: Computer, Monitor, Mouse
Step-by-step guide
To print out multi-value fields you need to use the mustache list iteration syntax. For the example above this would be:
{{#issue.fields.Equipment}} {{value}}{{/}} //Prints: Computer Monitor Mouse OR {{#issue.fields.Equipment}} {{value}}{{^last}},{{/}}{{/}} //Prints: Computer, Monitor, Mouse OR {{#issue.fields.QA Tester}} {{displayName}}{{/}} //For a multi-user select. Prints: Barney Rubble Fred Flintstone OR {{#issue.fields.labels}} {{.}}{{/}} //For a labels field. Prints: label1 label2 label3
'value' works for most multi-selects (checkboxes, multi-select). For a multi-user select you may want to use 'displayName' instead. For labels you have to use the special '.' (since it's just a list of strings).
Related articles