Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scrript error groovy.lang.MissingPropertyException: No such property: event for class

Shafiek Bloew
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 10, 2018

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

 

1 answer

0 votes
Eshwar Palem
Contributor
March 22, 2019

Helo @Shafiek Bloew ,

 

I am also getting the same error. Did you find anything how to resolve this?

Thanks,

Eshwar 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events