How can I automatically unassign a user based on the current user?

David Utteridge September 4, 2018

When raising a defect, the workflow we use automatically assigns the defect to me upon creation.

However, when I am the person raising the issue, I would like the assignee field to be cleared (so, essentially, to unassign me).

Is it possible to unassign an issue if the reporter = the current assignee on creation?

1 answer

1 accepted

1 vote
Answer accepted
Dennis S_ September 4, 2018

Hi @David Utteridge,

 

you can use a groovy script post function in the transition "Create" of your workflow. If you are the reporter, the assignee field will automatically be cleared by the transition. 

How to implement such a solution for your problem is described here: 

https://community.atlassian.com/t5/Jira-questions/clear-or-set-Assignee-to-null-if-Reporter-Assignee/qaq-p/32242

 

Best regards

Dennis

Dennis S_ September 4, 2018
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.security.Permissions
import org.apache.log4j.Logger
def log = Logger.getLogger("com.onresolve.jira.groovy.autoassign")
def componentManager = ComponentManager.getInstance()
def currentUser = componentManager.jiraAuthenticationContext?.user
def permissionManager = componentManager.getPermissionManager()
if (issue.reporterId == issue.assigneeId)
{
issue.assigneeId = ''
}
David Utteridge September 7, 2018

Thanks for your swift response, Dennis. This is really helpful!

I don't suppose you know of a way to do this without using an add-on?

Suggest an answer

Log in or Sign up to answer