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

Snippet

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

Placeholders

Placeholder

Description

Example

<Link type name>Name of the link typeis 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.

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

References