Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Add components lead to watchers

Rafael Moreira October 23, 2018

Hi,

I have 3 components in my project :

Components1 the component lead is User1, Components2 the component lead is User2 and Components3 the component lead is User3

I want to put in my JIRA with a script

If in my ticket I choose components1 and components2  User1 and User2 are watchers of the ticket and if I put components2 and components3 User2 and User3 are watchers of the ticket.

I know I need to made a script Listeners and I have tried some scripts and things but, they didn't work,

Anyone know how to do that ?

Thank you

1 answer

0 votes
fjodors
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 24, 2018

Hi

Try something like this:

1. you listener event is "issue updated"

2. when event fires, check issue's components.
I think you can get them using Issue interface and getComponents() method https://docs.atlassian.com/software/jira/docs/api/7.6.1/com/atlassian/jira/issue/Issue.html

3. get affected users.
You will need ProjectComponent interface and getComponentLead() method
https://docs.atlassian.com/software/jira/docs/api/7.6.1/com/atlassian/jira/bc/project/component/ProjectComponent.html

4. Then set/remove these users as issue's watchers (depends on your components) using methods from WatcherManager interface https://docs.atlassian.com/software/jira/docs/api/7.6.1/com/atlassian/jira/issue/watchers/WatcherManager.html

Suggest an answer

Log in or Sign up to answer