Forums

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

Jira Scriptrunner-Set Assignee in Post Function at Creation

Jon Starbird
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 13, 2018

I am trying to set the assignee to a specific user for a handful of issue types. I have searched online and everything I've found so far doesn't want to work. 

this is added as a Post Function Custom Script in the Create transition:

def issueType = event.issue.getIssueType().getName()
if ((issueType == "Copy / Cleanse & Upgrade Request") || (issueType == "VPN Request") || (issueType == "Document Image Options") || (issueType == "Server Access"))
{
issue.setAssignee('username')

on execution I get the following odd error:

2018-02-13 14:07:34,702 ERROR [workflow.ScriptWorkflowFunction]: *************************************************************************************
2018-02-13 14:07:34,702 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: null, actionId: 1, file: <inline script>
groovy.lang.MissingPropertyException: No such property: event for class: Script975
	at Script975.run(Script975.groovy:1)

 

This is using Jira 7.6.1 and Scriptrunner 5.2.2

 

 

1 answer

1 accepted

1 vote
Answer accepted
Jon Starbird
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 13, 2018

found the issue, I had grabbed part of this from a listener and forgot to take out the event portion.

First line should read:

def issueType = issue.getIssueType().getName()

then it all works fine of course. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events