Auto tag user in comments on assignment

We are looking for a way to automate tagging (@user) the reporter and assignee in the comments when a ticket is assigned.  So something like "@reporter your ticket has been assigned to @assignee for immediate action".   I tried using the automation pluging except there is only a $reporter variable and not an $assignee variable, and although it adds that users name it doesn't tag them.  Is there a way to do this in scriptRunner or another plugin?

2 answers

Hi @Christopher Gronde -

The Update on Transition for JIRA add-on supports adding a comment during a workflow transition, and includes many substitution variables (including Assignee and the user performing the transition) which could then be referenced within the comment.

This recipe shows how to automatically add a comment to a linked issue during a workflow transition using this add-on. It’s not exactly what you want and your scenario would be easier since you’re updating the same issue, but it will give you a feel for how to use the add-on. The recipe demonstrates adding a comment that references a substitution variable (%originaly_key%).

Here is a draft for script postfunction to add comment:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.comments.Comment
import com.atlassian.jira.issue.comments.CommentManager

CommentManager commentManager = ComponentAccessor.getCommentManager()

Comment comment = commentManager.create(
        issue
        , ComponentAccessor.getJiraAuthenticationContext().getUser()
        , "reporter "
        , true
)

commentManager.update(comment, true)

The issue with this is that I want it to happen after a ticket is assigned which isn't really a "post function"

Since you need to convert this code into a listener. I am not good into this. Try to ask more one question how to create a listener based on this code.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,760 views 11 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot