...
The values in all nodes like $context.issue.id
result in the value shown in the webhook data. For example "40301". The quotes normally need removing, and this can be done with $context.issue.id.asText()
.
Most properties lie under the $context.issue.fields prefix, as shown:
field | expression |
---|
Issue Key | $context.issue.key.asText()
|
Project Key | Code Block |
---|
$context.issue.fields.project.key.asText() |
|
Custom Field Value (Text) | $context.issue.fields.customfield_10610.asText()
|
Custom Field Value (Single Choice) | $context.issue.fields.customfield_13900.value.asText()
|
Custom Field Value (Multiple Choice) | Code Block |
---|
#foreach ($item in $context.issue.fields.customfield_13600)
$item.value.asText()
#end |
|
Reporter Display Name | $context.issue.reporter.displayName.asText()
|
Comment (if present) | $context.issue.fields.comment
|
All Comments (if present) | Code Block |
---|
<h1>Prior Comments</h1>
<p>Issue $context.issue.key.asText() has $fields.comment.total comments</p>
#foreach( $comment in $fields.comment.comments )
<h3>Comment created $comment.created.asText()</h3>
$jemhUtils.wikiToHtml($comment.body.asText())
#end |
|
Access individual comments | Code Block |
---|
<h2>STATIC comment extract</h2>
<pre>
1) $fields.comment.comments[0].id -- $fields.comment.comments[0].created -- <p>$fields.comment.comments[0].body.asText()</p>
2) $fields.comment.comments[1].id -- $fields.comment.comments[1].created -- <p>$fields.comment.comments[1].body.asText()</p>
3) $fields.comment.comments[2].id -- $fields.comment.comments[2].created -- <p>$fields.comment.comments[2].body.asText()</p>
</pre> |
|
Display comment is reverse order | Code Block |
---|
<h2>REVERSED comments</h2>
#if ($fields.comment.total >0)
#foreach($i in [1..$fields.comment.total])
#set ($actualIdx = $fields.comment.total - $i)
#set ($comment = $fields.comment.comments[$actualIdx.intValue()])
<p>
<h3>Comment created $comment.created.asText()</h3>
$jemhUtils.wikiToHtml($comment.body.asText())
</p>
#end
#else
no comments yet
#end |
|
Labels | #foreach ($aLabel in $context.issue.fields.labels) $aLabel #end
|
Sprint name |
|
Working with dates
Date timestamps | Code Block |
---|
#set( $createdStr = $comment.created.asText() )
#set( $timeStr = $createdStr.substring($createdStr.indexOf('T')+1) )
#set( $timeSplit = $timeStr.split(":"))
<h3>Comment created date: $createdStr.substring(0,$createdStr.indexOf('T')) at $timeSplit[0]:$timeSplit[1] </h3> |
|
Date (translate ISO dates) | Code Block |
---|
#set ($dateObj = $dateFormatter.getDate($comment.created.asText()))
$dateFormatter.format($dateObj, "dd/MMM/yy h:mm a") |
|
...