Automatic JIRA watchers based on custom field

Neil Taylor March 17, 2015

Hi,

I am trying to set up a ticket type that automatically adds watchers based on a custom field in JIRA.  Currently when I create a ticket, a huge list of watchers is automatically added on ticket creation.  I want to have different subsets of users added as a watcher based on field selections in a multi select list field instead of including the entire list of watchers as I do now - people are getting ticket updates for tickets that do not pertain to them and would like to prevent useless e-mails.

 

Any ideas on how to do this?

Thanks!

3 answers

1 accepted

1 vote
Answer accepted
Bob Swift OSS (Bob Swift Atlassian Apps)
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.
March 19, 2015

Use the Update issues post function from Update on Transition for JIRA to add watchers. Add a post function for each class of watcher subsets you have and condition the post function on the value of the custom field.

References:

 

Neil Taylor March 22, 2015

Thanks Bob. I'm evaluating your plugin now. I've been trying to create a condition to do what I need it to. I'm using a custom field called "Region" that is a checkbox field. I think that I am not getting the condition/expression correct. Do I use the name of the custom field or the field ID? Any special formatting for setting this up? Thanks!

Matthew Mares May 27, 2015

Neil, based on your issue, you'll want to add "original" in front of the field ID or field name because you're searching for the original issues custom field value. The formatting will go as such: - %original_<customfield name>% - %original_<customfield id>% Example: %original_customfield_10010% hth

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
May 27, 2015

Thanks for adding that Matthew! I missed Neil's comment :(.

Neil Taylor May 27, 2015

That was exactly what I was missing - I just tested it! Thanks guys! This project had made its way to the back burner, but everyone will be happy to know I found a solution!

4 votes
Matthew Mares May 27, 2015

Although Bob Swift's Update Issue post function is very sleek and useful, I find JIRA Worflow Toolbox's 'Set a field as a function of other fields' works best. You will only have to create one (1) post function to meet your needs. 

Simply choose a

  • read field (Region)
  • write field (Watchers)

and then add in the read values (left) and the write values (right)

  • (.*North East.*) user1
  • (.*South.*) user2
  • (.*Midwest.*) user3
  • (.*West Coast.*) user 4

Check the author's comment on 5/29/14 to see how to add and append watchers to a ticket.

AND because you are reading a multi-select field checkbox field, be sure to check the "Evaluate all the setting rules, not stoping at first match" field at the bottom of the setting rules box. This will append all users to the Watchers field that meet your criteria. 

hth

Neil Taylor May 27, 2015

Thanks!! I'm going to test this out too!

Neil Taylor June 10, 2015

This option was excellent. Easy to setup and works great! Thank you!

Ben Richman April 26, 2016

I know this is an old post but i am desperate for some help on this. Not sure what else to do.

 

I am trying to set a Watcher based on a User field (Single user) custom field when the user creates an issue:

 

The field Watchers will be set according to the evaluation of Project Manager against the following set of rules, not stoping at first match:
('ben.richman')ben.richman
This feature will be run as user in field Current user.

 

However this is not working and i am not being set as the Watcher. Can anyone help?

 

I have tried without the ' ' and tried with .* .* and just with *'s. I dont know what special characters should be around the user name, i've also tried with the full name rather than the user name, and still nothing works.

0 votes
Kelsey Collins March 19, 2015

I coincidentally was trying to figure out how to do this as well.

Suggest an answer

Log in or Sign up to answer