How am I able to set the assignee field of an issue based on a condition when a transaction is fired?
What I want to achieve is the following "condition":
projectRoleUsers = project.getUsersInRole("Rolename"); if(currentUser() in projectRoleUsers) { newAssignee = "unassigned"; } else { newAssignee = projectRoleUsers.first(); } issue.assignee = newAssignee;
I tried to achieve this by doing the following:
This however doesn't work as I want it to. Basically the Role can only be filled with one user (or empty). On this transition the assignee always needs to be set to that user unless the person executing the transition is the same user.
Hopefully someone can tell me how to set this up correctly
This code will unassign an issue when curUser = assignee:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.event.type.EventDispatchOption import com.atlassian.jira.user.ApplicationUser ApplicationUser curUser = ComponentAccessor.jiraAuthenticationContext.getUser(); if(curUser == issue.getAssignee()) issue.setAssignee(null) ComponentAccessor.getIssueManager().updateIssue(curUser, issue, EventDispatchOption, false)
Use it for script postfunction. Hope it will help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here a quick view of the situation how it should be;
The following works perfectly fine for automatically assigning the right user to the issue:
img01.png
From this point all I need is to check whether that person is the "currentUser()", if so the assignee should be assigned to "unassigned".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Paul,
As per the above description, i have a smillar question.
suppose i have a 'if condition' how we are going to right that condition for 'Code Review'
if ( Customfiedtype = Desktop||Laptop ) Assignee = code review
Please help me out on this..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.