scriptrunner post function to add watchers based on component

I am trying to write a post function using script runner to add watchers to the issue when created depending on components. 

I was able to get the watchers to be added but i am not able to get a condition check with component working. How do i get a list of components for the issue and then define a user list to be added as watchers.

5 answers

For example the following would be true if there is a component call Foo selected:

"Foo" in issue.getComponents()*.name

Hi Hermant, I'm trying to do the same thing- can you share the script you used to add watchers upon create issue?


@Jamie Echlin [Adaptavist], can you help with this? I'm just trying to get the script to run for adding watchers upon issue create. 

Apologies, my scripting capabilities are somewhat limited.  I took a look at the link but I'm not sure it suits the use case.  Upon issue creation (post function) I need a watcher to be automatically added based on a component selected.  I couldn't find that information in the link.  sad

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,820 views 18 22
Read article

Atlassian User Groups

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!

Find my local user group

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

Groups near you