Calculate and fetch a summary of last comments on issues linked to the current issue

Calculate and fetch a summary of last comments on issues linked to the current issue

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

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

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.

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

Need support? Create a request with our support team.

Copyright © 2005 - 2026 Appfire | All rights reserved.