Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Copying the comments from the actual to internal ticket in the same instance

Jai Vijay August 27, 2019

In the service desk queue, there is a ticket which is raised by the client and we will be creating a linked issue for our internal use and both happens in the same instance. As of now if the client made an update we are copying it manually and pasting it in the internal ticket. I wish to automate that process. Could someone please help me on this. 

2 answers

0 votes
Allison Carlson
Contributor
August 28, 2019

@Jai Vijay   

This is also possible using the 'Automation for Jira' add-on.    You may find that app easier to use than ScriptRunner as it has components and drop down boxes for building your rules. 

You can create a rule that copies the comment from one issue to the other using something like this:

  1. When: Issue Commented (this is the trigger)
  2. For Linked Issues (branch rule)
  3. If: project = your service desk project
  4. Then: Add comment to issue

in the comment box , you could include text similar to this: 

The following comment was added to the linked Jira issue: {{triggerissue.key}}: {{triggerissue.comment.last}}

 

this will pull the comment from the Jira issue and add it to the Jira service desk ticket's comment.

0 votes
Suresh Sakhare
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 27, 2019

Hi @Jai Vijay ,

This automation not available out of box. If you are using scriptrunner plugin you can implement update listener to do comments on linked issue.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.AbstractIssueEventListener
import com.atlassian.jira.event.issue.IssueEvent;

public class CopyComments extends AbstractIssueEventListener {

    @Override
    void workflowEvent(IssueEvent event) {

        def linkedIssue = "PROJECT-1";
        def commentManager = ComponentAccessor.getCommentManager();
        def issueManager = ComponentAccessor.getIssueManager();

        def comment = event.getComment()
        def targetIssue = issueManager.getIssueObject(linkedIssue);

        commentManager.create(targetIssue, comment.authorApplicationUser, comment.body, true);

    }

}

  

Jai Vijay August 27, 2019

Hi @Suresh Sakhare 

Thanks for the quick response. I will try this out and update you at the earliest. Thanks again. 

Jai Vijay August 28, 2019

Hi @Suresh Sakhare 

I have installed the script runner and I tried running the above script in the script listener. 

I received the error stating

"unable to resolved class com.atlassian.jira.component.ComponentAccessor"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events