Abstract
This code snippet calculates and creates a summary of last comments added on the issues linked to the current issue through a specific link type
Logic
- Iterate over each linked issue linked to the current issue through the specified link type
- Fetch the last comment on each linked issue and store in a variable
Snippet
Code Block | ||||
---|---|---|---|---|
| ||||
def summ = "" if(issue.getLinkedIssues("<Link type name>")==null) return null; issue.getLinkedIssues("<Link type name>").each{ if(it.get("comment")){ comm = it.get("comment").last() summ += "Comment on " + it.key + ": " + comm.getBody() +", created on " + comm.getCreated().format("dd/MMMM/yyyy hh:mm a") + " by " + comm.getAuthorFullName() + "\n" } } return summ |
...
Placeholder | Description | Example |
---|---|---|
<Link type name > | Name of the link type | is cloned by |
Examples
The output of the code snippet is a String which you could use in a Groovy script, for example, to calculate and display a summary of last comments added on the issues linked to the current issue through the "is cloned by" link type in a JMCF calculated text custom field.
Code Block | ||||
---|---|---|---|---|
| ||||
def summ = "" if(issue.getLinkedIssues("is cloned by")==null) return null; issue.getLinkedIssues("is cloned by").each{ if(it.get("comment")){ comm = it.get("comment").last() summ += "Comment on " + it.key + ": " + comm.getBody() +", created on " + comm.getCreated().format("dd/MMMM/yyyy hh:mm a") + " by " + comm.getAuthorFullName() + "\n" } } return summ |