Assign Issue to Reporter ONLY If Assignee Left Unassigned

Karl Seibert February 18, 2014

We have developers that create issues all the time. Most often, these issues are for themselves, so we'd like to have issues automatically assigned to the reporter. Sometimes developers assign issues to other users.

If I use the "Assign to Reporter" post function, the issue is assigned to the reporter even if he or she changes the assignee to someone else.

Is there a way to only assign to the reporter if the assign field is "Unassigned"?

Thanks!

Karl

5 answers

1 vote
Mevi Dvash February 6, 2020


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
def reporter = issue.getReporter()
def assingee =issue.getAssignee()

if (issue.assignee!=null){
issue.assignee=issue.getAssignee()


}else {

issue.assignee=issue.getReporter()
}

Max Howarth May 17, 2021

Where should this script be used/put?

Mevi Dvash June 9, 2021

Hi Max

You can use this script for on your workflow ,select a step in workflow select edit 

-->post function than you can add their a script ,i use this with ScriptRunner 

i am adding also links here to help you start with scripts on JIRA 

https://docs.adaptavist.com/sr4js/latest/get-started/tutorials/workflow-functions-tutorial/post-functions-tutorial

https://www.youtube.com/watch?v=DFvdK30lYuc

let me know if you need more info 

br

Mevi 

0 votes
Max Howarth May 31, 2021

For anyone coming across this page in the 2020's - this can easily be accomplished using Automations. See: https://www.atlassian.com/software/jira/automation-template-library#/rule/1381434

You can add a condition that if the Assignee IS EMPTY the automation will run. If your "Default" assignee is "Unassigned", this will only change the assignee to the reporter if a different assignee is not chosen.

0 votes
t August 14, 2015

Kimberly's solution did not work for me:

 

  1. The Assignee of the issue will be set to @#$@#$$.
  2. Creates the issue originally.
  3. Fire a Issue Created event that can be processed by the listeners.

I have it first yet whenever i try to create an issue, it always goes to the default assignee, not to the assignee that I select when creating the issue.

0 votes
Kimberly Kohler April 30, 2015

This can be achieved via post functions on the Create Transition in the Project Workflow.  You can make "Assign to Reporter" the first post function.  This will make Assignee = Reporter if the user did not change the value in the create screen (left it set to "Automatic").

0 votes
Thad West March 13, 2014

Out of the box, the answer appears to be no:

https://jira.atlassian.com/browse/JRA-27529

But....using a little script or a plugin can achieve the same trick:

https://answers.atlassian.com/questions/55934/how-to-assign-an-issue-to-the-current-user-on-create-transition

Suggest an answer

Log in or Sign up to answer