Hi all/Jamie,
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?
Community moderators have prevented the ability to post new answers.
Hi Warren,
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?!
Hi Benji,
I have never written a custom listener before, I will require assistance from start to finish? Can you help?
Where should I start and what knowledge is requred?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Warren,
In this case I would suggest you start here:
https://developer.atlassian.com/display/JIRADEV/Writing+JIRA+Event+Listeners+with+the+atlassian-event+Library
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Once the previous tutorial was completed you will have access to an IssueEvent object:
https://docs.atlassian.com/jira/6.2.3/com/atlassian/jira/event/issue/IssueEvent.html
From this class you can retreive info about the event:
- User that started the event
- Issue project
- Issue itself
-...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
https://docs.atlassian.com/jira/6.2.1/com/atlassian/jira/security/groups/GroupManager.html
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
https://confluence.atlassian.com/display/JIRA/Moving+an+Issue
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The last step is to update the issue assignee and this is done with the IssueService:
https://developer.atlassian.com/display/JIRADEV/Performing+Issue+Operations#PerformingIssueOperations-EditinganexistingIssue
The IssueInputParameter you need to set is setAssigneeId.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
https://docs.atlassian.com/jira/6.2.1/com/atlassian/jira/project/Project.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In order to use your plugin you have to upload it to your JIRA instance:
https://confluence.atlassian.com/display/UPM/Installing+add-ons
Hope this gets you on track?!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, I'll make a start and then comment back if i get stuck.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, I'll check for updates :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.