Page History
Now you know how to show an issue key, it's time to go further and learn how to display ANY field in your JIRA. Right now, we'll show task summary and assignee email.
No Format |
---|
#foreach ($issue in $issues)
Summary: $issue.fields.summary
Description: $issue.fields.description
#end |
This renders as:
Code Block | ||
---|---|---|
| ||
Summary: Deprecate Handlebars and remove combo for template type selection
Description: Preserve old templates in handlebars |
If you have a look at our reference JIRA issue, then you'll see that most of the fields of interest to us are sitting under the "fields" element. This is why we refer to them as $issue.fields.YOURFIELDNAME
What if you need to show a custom field? That's easy, because custom fields are "first-class citizens" and they are treated the same way as standard fields. See line 4 on the following example
No Format |
---|
#foreach ($issue in $issues)
Summary: $issue.fields.summary
Description: $issue.fields.description
Messenger name: $issue.fields.customfield_10126
#end |
This renders as:
Code Block |
---|
Summary: Deprecate Handlebars and remove combo for template type selection
Description: Preserve old templates in handlebars
Messenger name: P1 Escalated in Production |
To wrap things up we'll show you how to display an array of fields. Let's say, we need to see all the comments made to issue. The following script will do:
No Format |
---|
#foreach ($issue in $issues)
Summary: $issue.fields.summary
Description: $issue.fields.description
----------------------Comments----------------------
#foreach ($com in $issue.fields.comment.comments)
$com.body by $com.author.displayName
#end
#end |
It will render as:
Code Block |
---|
Summary: Deprecate Handlebars and remove combo for template type selection
Description: Preserve old templates in handlebars
----------------------Comments----------------------
This will simplify further support by Inversion Point [Administrator]
one more comment by Inversion Point [Administrator] |
Again, if you have a look at our reference issue, then the statement on line 5
#foreach ($com in $issue.fields.comment.comments)
will make a perfect sense.