Hello.
I'm trying to figure out, how using script listener, change existing assignee to moved project def. project lead.
Like - now it's in "Project 1" and I need to move it to "Project 2". I need to change assignee to "Project 2 " Project Lead.
Any ideas how to do it?
Hello @Māris Freimanis
Add a custom listener which is listening to issue move events and in that listener you can write the code to update the assignee.
@Tarun Sapra I have done it that far. But I'm not that good at coding yet. Can't figure out how to do it. Tricky part is to restrict it that auto assign to project lead happens only, if I move from Project A to project B, but not happen if I move project A to project C or B to A.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can get the project lead user name and then update the issue with issueManager
def userName = issue.getProjectObject().getLeadUserName()
The use the code sample from below to update/edit an existing issue
https://developer.atlassian.com/server/jira/platform/performing-issue-operations/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks. that actually helped me a lot.
So I have got this far. It assign pretty well now.
Only question is, is there a way, to use this only if there is transition from, like project A to project B? But it's not working when move from project C to B.
If I put Project B in Project Key then it works also if I move from project C to B. But I want to make it only when it's moved from A to B.
My code so far:
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.event.type.EventDispatchOption;
def issue = ComponentAccessor.getIssueManager().getIssueObject(event.getIssue().getId());
if (issue.getAssignee() == null) {
def userName = issue.getProjectObject().getLeadUserName();
issue.setAssigneeId(userName);
}
ComponentAccessor.getIssueManager().updateIssue(ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser(), issue, EventDispatchOption.ISSUE_UPDATED, false);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Tarun Sapra this is your final code? I have a similar case where I what to change the Assignee (projectLead in my case when a issueMoved in a Listener) but no solution, found do this action. Can you help me? tks
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.