I need assistance with a custom listener, based on (https://answers.atlassian.com/questions/292619/move-issues-assignee-automatically-project-lead-only-please-assist?page=1#292652)
1. I have create a permission scheme that allows users in role (Operational Support) to be allowed to move issues between projects, but not assign permission. These tasks need to be assigned to the project lead automatically.
2. I need a listener that will recognise a user in role (Operational Support) when moving a task between projects. During the moved the assignee needs to become the project lead.
Once the project lead has recieved the issue, this person has the permission to assign it the the correct person based on the priority on the issue.
Can anyone assist me?
I would suggest you write a custom listener that listens for Issue Moved events. From the IssueEvent class you can get all information about the project and the user who initiated the event. Make use of the ProjectRoleManager (https://docs.atlassian.com/jira/6.2.1/com/atlassian/jira/security/roles/ProjectRoleManager.html) to check if the user who initiated the event has the Operational Support role. If so you can get the project lead user object from the current project and set this as a assignee for the project.
Feel free to ask more questions :) Hope this gets you started?!
In this case I would suggest you start here:
This tutorial learns you how to write a custom plugin that registers a listener to receive issue events. The programming language used here is Java, but the basics for other languages (f.e Groovy) is the same.
Once the previous tutorial was completed you will have access to an IssueEvent object:
From this class you can retreive info about the event:
- User that started the event
- Issue project
- Issue itself
The next step is to check that the user who initiated the event has the group Operational support and this is done via the GroupManager:
The method getUsersInGroup returns all users that are part of a certain group. To check wether the user from the IssueEvent is in this list of users. Then you know that he also has the group Operational Support.
Your listener has to keep some state, because an issue move event from one project to another consists of 2 event:
1) Project 1 will throw a move event
2) Project 2 will throw a create event
You have to check that when you retrieve a create event in project 2 that a move event was also fired in project 1 for the same issue. Otherwise the create event was not caused by an issue move.
The last step is to update the issue assignee and this is done with the IssueService:
The IssueInputParameter you need to set is setAssigneeId.
When the create event for project 2 was fired you can retrieve the project from the IssueEvent class and next retrieve the project lead user object from the Project class:
In a world of dark-scrum, faux-scrum, and scrum-butt, the question still remains: What is scrum and how do you do it “right?” That’s the question we set out to answer. I'm Max, I've been teaching c...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs