Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Use generic service desk account to answer customers


I would to answer with an generic account in my service Desk. But I want to know who make the answer in internal.

I use the script Listeners and the event : ServiceDeskCommentEvent

The script must to do :

Verify if account is service Desk
Verify if answer is for customer (external)
Delete the last comment
Write internal comment with the current user
Write external comment with generic account of service Desk

I do all of that if I know the Issue number. (with getIssueByCurrentKey() )

Now I would to do this with all issues when the event is trigerring. But it's not working with issueEvent.getIssue().

I need this kind of function for all events on Issues comments

import com.atlassian.crowd.embedded.api.Group
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.issue.comments.MutableComment
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.util.json.JSONObject
import com.atlassian.jira.issue.comments.Comment
import groovy.json.JsonSlurper

final SD_PUBLIC_COMMENT = "sd.public.comment"

CommentManager commentManager = ComponentAccessor.getCommentManager()

//def issue = issueEvent.getIssue()

//def issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("I-01")

def groupManager = ComponentAccessor.getGroupManager()

ApplicationUser supportUser = ComponentAccessor.getUserManager().getUserByName("ahl")
ApplicationUser currentUser = commentManager.getLastComment(issue).authorApplicationUser

MutableComment mutableCommentSupport = (MutableComment) commentManager.getLastComment(issue)

def comment = commentManager.getLastComment(issue)

def commentPropertyService = ComponentAccessor.getComponent(CommentPropertyService)

def isInternal = { Comment c ->
def commentProperty = commentPropertyService.getProperty(currentUser,, SD_PUBLIC_COMMENT).getEntityProperty().getOrNull()
if (commentProperty) {
def props = new JsonSlurper().parseText(commentProperty.getValue())
else {

if (comment) {
if(isInternal(comment) == false) {
def properties = [(SD_PUBLIC_COMMENT): new JSONObject(["internal": true] as Map)]

if (['Hotline','jira-servicedesk-users'].any {groupManager.isUserInGroup(currentUser, it)}){
if(currentUser != supportUser) {

//delete original comment

//External comment
commentManager.create(issue, supportUser, mutableCommentSupport.body, false)
//Internal comment
commentManager.create(issue, currentUser, mutableCommentSupport.body, null, null, new Date(), properties, false)

0 answers

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events