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 vote

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

809 views 2 19
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