I am trying to create a scripted field in Scriptrunner to give me the first commentor on an issue by group. For some reason I am getting the following error.
groovy.lang.MissingPropertyException: No such property: event for class: Script283
for this line
def event = event as IssueEvent
Even though I have another script using the classes and about line of code.
import com.atlassian.jira.bc.issue.comment.property.CommentPropertyService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.issue.comments.Comment
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.security.groups.GroupManager
import groovy.json.JsonSlurper
final SD_PUBLIC_COMMENT = "sd.public.comment"
def event = event as IssueEvent
def user = event.getUser()
def comment = event.getComment()
def commentPropertyService = ComponentAccessor.getComponent(CommentPropertyService)
def commentManager = ComponentAccessor.getComponent(CommentManager)
def groupManager = ComponentAccessor.getComponent(GroupManager)
def isInternal = { Comment c ->
def commentProperty = commentPropertyService.getProperty(user, c.id, SD_PUBLIC_COMMENT)
.getEntityProperty().getOrNull()
if (commentProperty) {
def props = new JsonSlurper().parseText(commentProperty.getValue())
props['internal'].asBoolean()
}
else {
null
}
}
def firstComment = commentManager.getComments(issue).findAll {
def groups = groupManager.getGroupsForUser(it.authorApplicationUser)
"agent-group" in groups
}.min {
it.created
}
if (! firstComment) {
return null
}
if (isInternal(firstComment)) {
return firstComment.authorApplicationUser
}
return null
Anyone have any suggestions
Helo @Shafiek Bloew ,
I am also getting the same error. Did you find anything how to resolve this?
Thanks,
Eshwar
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.