It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to add watchers using post function - without scripting

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 Nov 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

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 Nov 11, 2019

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

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

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

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?

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

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...

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

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

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
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you