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

Scriptrunner context variables in worklog listener

Tom Hudgins
Contributor
July 17, 2024

Hello,

I've got a Scriptrunner listener that listens for worklog entries. My script runs fine and does its job but I'd like to use the condition section to reduce the executions to eliminate runs that I don't care about. I want to ignore worklog entries from issues that are not of a certain issue type. 

I tried using these Jira expressions :

["New Software Request"].includes(issue.issueType.name)

or

["New Software Request"].includes(new Issue(worklog.issueId).issueType.name)

but I get an error saying either issue is null or worklog is null.
In the script itself I use worklog.issueId to get the issue key of the triggering issue but it doesn't seem to exist in the conditional section. 
I'm confused.

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Jim Knepley - ReleaseTEAM
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
July 17, 2024

I'm not a master with Groovy, but I don't think "includes" is a valid list method.

Do you mean "contains" ?

Issue issue = event.getIssue()
["New Software Request"].contains(issue.getIssueType())

 

Tom Hudgins
Contributor
July 19, 2024

The conditions section takes a Jira "expression" which is not strictly groovy - more akin to Javascript. includes is a valid list method 

https://developer.atlassian.com/cloud/jira/software/jira-expressions/

TAGS
AUG Leaders

Atlassian Community Events