Forums

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

Additional issue actions in "Create a sub task" post function

Aravindi Amarasinghe
Contributor
February 12, 2018

Hi All, 

I have a requirement to assign the auto created sub task to the parent issue creator (Current user) 

Can someone please suggest me a code for that requirement in "Additional issue actions" section? 

1 answer

1 vote
Alexey Matveev
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 12, 2018

I think you are talking about ScriptRunner. If so then the code would look like this

issue.setAssignee(issue.getParentObject().getAssignee())
Aravindi Amarasinghe
Contributor
February 13, 2018

Hi @Alexey Matveev

Thank you for the answer but this throws me a error such as 

java.lang.NullPointerException: Cannot invoke method getAssignee() on null object

I wonder why as this subtask creation post function is the last in the list and parent issue creates before that. 

how ever I tried this one and it worked for me. 

issue.setAssignee(issue.getReporter())
Alexey Matveev
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

How do you create sub tasks? Sub tasks can not be crated before the parent task, which means, that the code I gave you is triggered not for a subtask, but for the task. Make sure that the code is executed for a sub task.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events