Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Use generic service desk account to answer customers Edited

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
Community showcase

The benefits of using Jira in different departments

Jira is a great tool to use across different departments. Forget that paperwork – switch to Jira and get that tasks done smoothly. Marketing Jira allows for a complete digital transformation of you...

72 views 0 3
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you