Hi community,
I have a script which is supposed to create a log of all external comments during an event listener.
Here is my code:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.issue.comments.Comment
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.event.issue.IssueEvent
import groovy.json.JsonSlurper
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.servicedesk.api.comment.ServiceDeskCommentService
import org.apache.log4j.Logger
import org.apache.log4j.Level
import com.atlassian.jira.bc.issue.comment.property.CommentPropertyService
@WithPlugin('com.atlassian.servicedesk')
@PluginModule
ServiceDeskCommentService serviceDeskCommentService
final SD_PUBLIC_COMMENT = "sd.public.comment"
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def commentPropertyService = ComponentAccessor.getComponent(CommentPropertyService)
def commentManager = ComponentAccessor.getCommentManager()
def event = event as IssueEvent
def issueManager = ComponentAccessor.issueManager
def issue = event.getIssue()
def comment = event.getComment()
def isInternal = { Comment c ->
def commentProperty = commentPropertyService.getProperty(user, c.id, SD_PUBLIC_COMMENT).getEntityProperty().getOrNull()
}
commentManager.getComments(issue).each {
if (isInternal(it) == false){
def log = Logger.getLogger("Comments")
log.setLevel(Level.DEBUG)
log.debug it.body
}
}
The problem is that no log is being created even if the script work without error.
Is there a problem with the script?
Best regards,
Jason Li
do I understand you basically right that it would suffice to have the whole history of external comments listed in a reply that goes out to the customer BUT not only the last one?
If this is understood correctly voting for the following Suggestions might be a good idea to show it is of interest to your team:
https://jira.atlassian.com/browse/JSDSERVER-5228
Regards,
Daniel
I don't have an answer for you but I'm curious what the use case is for this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kristin Lyons,
First of all, I excuse myself for wrong wording I used. I mean external comment rather than internal.
Second, the case scenario is that our client do not want to use portal and use email request only. In this situation, they need to provide their customer of all external comments which the latter create.
Unfortunately, JSM only provide the last external comment of the ticket when replying by email and this is an issue for our client.
Hope this clarified the case.
Best regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the use case. Is there a specific reason why the client does not want to use the portal? Sorry that this is not answering your question directly but maybe we can figure out another way to get this to work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.