I'm trying to set the assignee during a transition. I would like to assigne the user, selected in the default assigneepicker of the transitionscreen, or if it's on automatic or not selected to set the current user as assingee.
Does anyone have an Idea how to handle this?
Mo
Community moderators have prevented the ability to post new answers.
You could definitely achieve that by creating a custom script post-function with Script Runner that does something like this:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue def Issue issue = issue if (!issue.assignee || issue.assignee.name == "myAutomaticUser") { def currentUser = ComponentAccessor.jiraAuthenticationContext?.getLoggedInUser() issue.assignee = currentUser }
Hi Alejo, thank you for your input. Do I need to replace myAutomaticUser with the user name to be expected? Or may I can also directly query the "automatic assignment" option from the transition screen? So far I'm not yet the JIRAGroovyInternalsDeveloperGuy... but maybe I am becoming so.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, you will need to replace myAutomaticUser with the username of the default assignee of the project.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK understand. Then I have to preparde a longer List of assignees corresponding to the selected component and project. Is ther now way to query the transition screen from a post function?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Why would you need a list of assignees? Sorry, I probably don't understand your question.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok, that makes sense. In that case you could do something like this: import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue def Issue issue = issue if (!issue.assignee || issue.componentObjects.any { it.name == issue.assignee.name}) { def currentUser = ComponentAccessor.jiraAuthenticationContext?.getLoggedInUser() issue.assignee = currentUser }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried this in Open transition but it doesn't work there. In another transition it works fine.
So what's the reason why?
Whar can I do?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can probably use the Script Runner Add-On to craft a script that will do that for you. By default this is not possible in JIRA.
-- Pedro
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.