How to add watchers using post function - without scripting

Daniel Brvnišťan November 11, 2019

I saw in another thread that it is possible to add watchers using post function on issue transition.

But I don't see such option in our JIRA 8.4 instance.

Is it possible to do without a plugin?

This is what they see:

1.PNG

Vs. what I see:

3.PNG

 

2 answers

1 accepted

1 vote
Answer accepted
Peter DeWitt
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 11, 2019

@Daniel Brvnišťan , to answer your specific question, No. You can't add Watchers in naked Jira. You will need to use an app to do this. I see from your screen shot you have scriptrunner so this should be pretty easy to do.

Here is a previous question on the community that could help you out:

https://community.atlassian.com/t5/Jira-questions/ScriptRunner-for-Jira-Cloud-Add-watcher-in-ScriptRunner-Post/qaq-p/1177008
Daniel Brvnišťan November 11, 2019

Thanks Peter,

I wanted to use out of the box feature if there is one, but since not, I will go with ScriptRunner, thanks for the hint on the other thread.

Daniel

Peter DeWitt
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 11, 2019

I understand, I always like to keep things out of the box when possible. Good luck to you!

1 vote
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 11, 2019

Hi Daniel,

I can confirm that if you are using Jira Server as you have indicated that the community answer linked to above will not work inside of Jira Server as this is for Jira Cloud.

However, I can confirm that if you install ScriptRunner for Jira Server that you can use the Add Watcher listener to automatically add watchers to an issue as described here.

I hope this information helps.

Regards,

Kristian

Daniel Brvnišťan November 11, 2019

Hi Kristian,

Thanks for the tip - I looked at that page, but I am trying to add a specific group when a specific transition happens. I created the event and now I am creating the listener - if I get stuck I will post a new question, and I bet you will have a solution :)

Thanks!
Daniel

Daniel Brvnišťan November 12, 2019

Well, I found one issue, that I am getting constantly, not sure you will be able to reproduce.

  1. Create issue
  2. Change status to one triggering the listener
  3. Watchers (3) are correctly added by the script
  4. Remove watchers manually
  5. Edit, transition or just refresh the issue - there is no custom event/listener configured
  6. Two out of the three watchers are added again - no idea why

Any ideas?

Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 12, 2019

Hi Daniel,

Thank you for your response.

It sounds like there is some other configuration the that is adding the two watchers when it is manually triggered such as a post function and I would advise reviewing your workflow to identify what could be causing this behaviour.

Regards,

Kristian

Daniel Brvnišťan November 12, 2019

It couldn't be workflow as it happens even if there is no transition, mere change of one field, and actually just refreshing the issue. And it started exactly when the listener was added...

Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 12, 2019

Hi Daniel,

So that I can try to help yourself diagnose the cause of this further can I please ask if you can provide a screenshot of how the listener has been configured as without seeing this it is hard for me to understand what is configured in your instance. 

Also, can I ask if you have checked your *atlassian-jira.log* file from when this behaviour occurs as I would advise that you check this in order to identify what is causing this behaviour?

Finally, can I ask if you remove the listiner and then re edit the issue does this behaviour still occur?

Regards,

Kristian

Daniel Brvnišťan November 20, 2019

Hi Kristian,

Sorry for the delay in reply.

Here is the listener, logs are coming.

When I pause the listener, it still happens on those issues where the listener once ran, but not on any new issues.

listener.PNGThanks,
Daniel

Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 20, 2019

Hi Daniel,

Thank you for your response.

I can confirm the listener shown in your attached screenshot is only configured to fire on the CC status changed to INV event which means any workflow in your instance configured to fire the event will trigger this listiner.

Can I ask if you completetly delete the listener does the behaviour still occur and have you checked as suggested previously if any other script listeners or scripts are configured that can modify the watcher's field on your instance.

Diagnosing this issue further on this community thread is now out of scope and I would advise that you raise a support request inside of the ScriptRunner Support portal located here and to attach the logs so the logs can be reviewed if you need further assistance with diagnosing what is causing this behaviour.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer