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

0 votes

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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,803 views 11 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot