How to add a comment added during the transition of the parent issue as a comment on its linked issues

Requirement

As a JIRA Administrator, I want every comment entered on the parent to be copied onto the sub-tasks.

What should be achieved in the requirement?

  • Fetch the comments provided during the transition of the parent issue.
  • Copy the last entered comment on the parent issue to all its sub-tasks.

What do you need?

  • JIRA Administrator login
  • JIRA Misc Workflow Extensions plugin

 

 

How to do?

 

  1. Click Edit for the workflow. In the Workflow Designer, select the transition you wish to configure the post-function on.
  2. Click on Post Functions in the properties panel.
  3. Click on Add post-function.
  4. Select Comment linked issues from the list of post-functions.
  5. Select the link jira_subtask_outward from the Issue Link drop-down.
  6. Select comment type as Raw Value from the Comment type drop-down.
  7. Input the following groovy script in the Value field.

    com.atlassian.jira.issue.comments.CommentManager commentManager = com.atlassian.jira.ComponentManager.getComponent(com.atlassian.jira.issue.comments.CommentManager.class);
    commentManager.getLastComment(issueObject).getBody();
  8. Click on Add to add the post-function to the transition.

 

What to test?

  1. Create an issue in the project.
  2. Create sub-tasks for the above created issue.
  3. Trigger the transition of the parent issue, on which the post-function is configured.
  4. Add a comment during the transition.
    (tick) The linked issues should be commented with the same comment entered for the parent issue.

Â