Add comment during transition does not trigger email notification

Ruben Demey March 30, 2015

I've created a groovy script that runs during a specific transition. It adds a simple comment by a specific user.

I'm expecting an email notification to be sent to the reporter, as is described in the notification scheme, but this is not working. It does when doing manual comments.

This is my groovy script:

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.comments.CommentManager
 
ComponentManager componentManager = ComponentManager.getInstance()
CommentManager commentManager = componentManager.getCommentManager()
 
commentManager.create(issue, "username", "Message bla bla bla", false)

3 answers

1 accepted

3 votes
Answer accepted
Cesare Jacopo Corzani
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.
March 31, 2015

The last parameter should be true if you want to trigger the event

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 30, 2015

That's because the "comment" event is fired by commenting on the issue.  Adding a comment with code like this is not commenting on an issue, it's just adding comment data to it (I know, it's the same effect, but it's only adding data, it's not going through all the whole process).  Your script will need to fire the additional event or send its own email.

0 votes
Ruben Demey March 30, 2015

Do you happen to have an example of how to fire such an event for this particular case?

Suggest an answer

Log in or Sign up to answer