How can I automatically add Watchers to Bugs in Jira Cloud?

Beverly Vessella April 5, 2018

We need to notify multiple people when a bug is created (product manager, dev lead).  Adding a post function to the Create transition in the workflow to assign to project lead only gets us so far.

It seems there are many ways to do this with a script in Jira Core, but I have yet to find a solution for Jira Cloud.

Apologies if this has been solved in the past!  Please link if this is the case.

7 answers

1 accepted

1 vote
Answer accepted
Aswin Achuthan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 5, 2018

Hi Beverly,

In workflow post-condition of Create issue, we can add users as watchers.

Since Jira doesn't allow us to update this field in post function, we can create a dummy watchers field and add users to it, then add one more post function to copy values from dummy watchers field to actual Watchers field.

This will be useful for your company's product manager, dev lead etc.. to track using "issues watched by me" filter. I assume your notification scheme might have watchers added to all activity. So, it should send out notifications to them.

Beverly Vessella April 5, 2018

Thanks Ashwin -- what I'm seeing is that there isn't a post function to actually copy values from a dummy watchers field to actual *Watchers* field.

Aswin Achuthan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 5, 2018

You'll have to create new custom field something like "Dummy Watchers",then assign it to project and then use "Update Issue Custom Field" option in workflow post condition.

Next step is to add "Copy Value From Other Field" post function, here add source field as "Dummy Watchers" and Destination field as "Watchers"

Beverly Vessella April 5, 2018

Yes, but in the second step, the actual Watchers field is not part of the pick list for Destination Field?

Aswin Achuthan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 5, 2018

can you check if the dummy custom field created is of type "User Picker" ?post condition.pngCopy values.png

Beverly Vessella April 5, 2018

I realize I made my dummy Watchers field just "Watchers" and it actually overloaded this option in the picklists!

Now that I made my dummy Watchers field "Watchers (dummy)" it shows up as your screenshot does.

Thank you!!

Beverly Vessella April 5, 2018

@Aswin Achuthan Sorry to be so annoying.. I've been at this for an hour.  I can't seem to get the data type to be right.  For example, I just want myself to be added to a watcher on bugs that are created.

I've tried setting Watchers (dummy) as a User Picklist and also as a free text field.  I've tried beverly and Beverly Vessella and all quote combinations.  Watchers (dummy) is set correctly.

But when I try the second step of copying this value over to the real Watchers, it's complaining to me that the field configuration is wrong.

Do you have suggestions for the exact data type or syntax here?

Aswin Achuthan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 5, 2018

@Beverly Vessellano problem :)
The custom field(Watchers dummy field) type should be User Picker (multiple users)

And, value to update in dummy watchers field should be the username.

Let me know if you face any issues

Beverly Vessella April 5, 2018

@Aswin AchuthanI don't know what I'm doing wrong.

Custom Field: "Watchers (just Beverly)"

 

image.png

 

Username: beverlyimage.png

 

Post functions on Create:

image.png

Published the new workflow.  Results when I try to create a new bug:

image.png

Thanks so much for your help!

Beverly Vessella April 5, 2018

The system has no issue with the first post function of setting "Watchers (just Beverly)", but throws the error when I add the second post function.

Aswin Achuthan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 5, 2018

@Beverly VessellaThose two post functions should be added after existing post condition. The order of post functions really matters :)

  • Create the issue originally should be always on top of all. (use arrow mark to move to 1)
  • If you have anyotherpost functions(eg: notifications etc..) it should be in 2,3, 4... positions
  • Make your exisitng 1st point as last before one. eg: "The Watchers (just Beverly) of the issue will be set to beverly" should be in 5th step
  • and 2nd step as last step. eg: "The field Watchers will take the value from Watchers(just Beverly)...." as 6th step.

 

so basically, we can update the fields only after issue is created. let me know if it works! :)

Like Santhosh Kumar likes this
Beverly Vessella April 5, 2018

WORKS.  Thank you so much.  That was a silly error on my part!

Aswin Achuthan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 6, 2018

no problem :) Glad I could help

Senthilkumar February 4, 2019

@Aswin Achuthan i have created Dummy watchers and assigned to the project. Since i need only two users to be auto watchers, i am not sure who to do it.

it would be great i you can help it for me.

 

@senthil

Senthilkumar February 4, 2019

@Aswin Achuthan

as you said in the last updates, i have a question. What should we have to do  on  "Update Issue Custom Field" option in workflow post condition."

 

Appreciate your help.

 

Senthil

Aswin Achuthan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 11, 2019

Hi @Senthilkumar use comma(,) to separate users if your custom field is multiple user picker

Ray Palmer February 25, 2020

If you have the JSU Automation Suite, you can do this by adding a "Update Any Issue Field (JSU)" Post Function to update the system field Watchers directly (rather than the "Update ..." and "Copy... " two-step process above).

Marta Ferreira August 23, 2021

@Aswin Achuthan what do i do if i don't have 'Copy Value from Other Field' option available in my 'Add Post Function to Transition'?

Hope you can help me, thank you. 

1.PNG

Aswin Achuthan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 23, 2021

Hi @Marta Ferreira , you need third party plugin to do that in server/DC

Like Marta Ferreira likes this
0 votes
Jim Reynolds December 17, 2021

You have 2 options.

 
Option 1: How to subscribe to watch all items in a project. Assuming you're an Admin these are the steps.
  1. Go to Jira
  2. Click on the cog wheel in the upper right corner and select Projects
  3. Search for your project
  4. In the left Nav towards the bottom click on Notifications
  5. In the upper right hand corner click Actions then Edit Notifications
  6. In the right column click Add for the event you want to watch
  7. There are a couple options. Pick the best one for you

Subcribe at the project level.jpg

 

Option 2: How to subscribe to a Jira filter to receive 1 email with a summary of the changes based on your Jira filter
  1. Create a filter and save it.
    1. Sample Filter to show Jira IDs updated in the last day:
      Project = "Project X" AND updated >= -1d
  2. Now go to Issues --> manage filters --> Subscribe

Subscribe Menu.jpg

0 votes
Nathan Schneider
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 20, 2019

Hey everyone, I need some help with this.

I can't seem to get the post function 'Update Issue Custom Field' to set the User Picker (multiple users) with a username.

I've tried the user's full name, username, email address, and I can't even get it to work when using %%CURENT_USER%%. For some reason, it just won't populate the user picker with a username that I can use to copy to the watcher field.

I've also tried moving the post function positioning around and that did not seem to help either.

Does anyone have any ideas?

Thank you!

Ray Palmer February 25, 2020

Might be a bit late to help you, but when I ran into the same issue, it was because I'd set this Post Function to run before the issue was created. Make sure your post function happens after "Creates the issue originally."

0 votes
Jay Keck June 3, 2019

Out of curiosity, since you can't assign the value of watchers in the post section until after the issue is created, does that mean that the watchers will not get notified of issue creation, even if notification scheme says "all watchers" for issue created event?

0 votes
MariiaBoikoDigi April 19, 2019

Dear Jira guru, I've managed to setup automatic watchers adding on creating an issue, thank you for all the comments above. 

But I'm struggling with the next problem:

  • issue is created in a project where I don't need the watchers
  • when move the issue to the project where I want to add the watchers the dummy watchers field is filled properly, but real watcher are not updated

Any ideas are highly appreciated.

Screenshot at Apr 19 17-18-16.pngScreenshot at Apr 19 17-19-48.pngScreenshot at Apr 19 17-29-09.png

0 votes
Anna Marcilla October 1, 2018

I'm trying to assign several watchers in the same ticket
I'm so sorry, but i used to do it with old versions and this it was so easy to use.

Now, i'ts a nightmare .. can't believed i have to do all steps wroted above

0 votes
Jonny Adams
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 5, 2018

@Beverly Vessella You can manage this in your notifications scheme.

Open Jira Administration>Issues>Notification Schemes, find the scheme for the desired project and click on notifications. Add the desired users, roles, or groups to the notification for Issue Created.

Beverly Vessella April 5, 2018

Thanks Jonny!  I was afraid this was the only way :).  We have a tidy notification scheme right now across all projects and issues types.  Looks like I'll have to make a different one to apply to just bugs in particular projects.

Beverly Vessella April 5, 2018

@Jonny Adams is there any way to scope this only to Bugs, and not all Issues?

Jonny Adams
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 5, 2018

@Beverly Vessella Notifications are project based so you wouldn't be able to specify a particular issue type unless you used an add-on. We use Automation for Jira which will allow you to specify issue types and trigger a notification to particular users/roles/groups when created.

I believe ScriptRunner may also provide similar functionality. 

MariiaBoikoDigi April 19, 2019

Hi there! It's possible if add the post function to a flow and then use this flow bug bugs only (I know you conversation was a year ago, but maybe someone finds it helpful)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events