Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,297,061
Community Members
 
Community Events
165
Community Groups

Add watcher automatically based on a custom field

I have a custom field 'Evaluators' where the user can select multiple people from the organization. Is it possible to create an automation that would pick up the evaluators from the field and add them as watchers on the issue?

6 answers

3 accepted

4 votes
Answer accepted
Alex Koxaras Community Leader Sep 15, 2021

Hi @Ani Popova 

Yes you can! Use the following rule and replace approvers with Evaluators:

approvers.png

Keep in mind that evaluators must have permissions to view the issues.

John M Funk Community Leader Sep 15, 2021

Ah! Well done, Alex!

Like # people like this

Hmmmmm, that's a very good idea actually, thanks a lot!

Like # people like this
1 vote
Answer accepted

Hi @Ani Popova 

If you are selecting those evaluators from the Jira users, and you can get the accountId from the selections, then you may add them as watchers with an automation rule.

The trick may be to split out the accountId values from the field, split it into a list, and then use advanced branching to iterate over them to add each watcher.  Another way might be to use advanced edit with JSON to add them all at once.

Kind regards,
Bill

Withdrawing my answer, based upon Darryl's comments.

I see what you mean, that's going to take a long branch rule, because probably have about 15-20 people to loop through, but it would work! 

The disadvantage would be that every time a new person gets hired, I will have to change the rule. 

Hi, Ani!  This would still be dynamic; the values from the field drive the new advanced branch mechanism which was recently added.  So the branch would just have a few components.

For now, I recommend starting with what Alex suggests based upon the field-value changed trigger.  If you run into challenges with add/remove watchers and duplicate watchers, this other technique could help.

Kind regards,
Bill

Withdrawing my answer, based upon Darryl's comments.

Whoa whoa whoa! :-}

As much as I love complex branching rules that can iterate over lists, this one can be solved much more easily, because thankfully, Atlassian/CodeBarrel implemented Watchers differently than other fields.

And you can actually add Watchers without affecting existing Watchers (which was my concern with doing any kind of fancy JSON).

Like # people like this
1 vote
Answer accepted
John M Funk Community Leader Sep 15, 2021

Hi Ani,

Unfortunately, automation only has the ability to have an actual username selected to add to the watcher field not not groups or values from other fields. 

You might could do it via the API, but that is out of my expertise. 

Darryl Lee Community Leader Sep 15, 2021

Hey @John M Funk sorry, but this isn't actually correct:

watchers.jpg

John M Funk Community Leader Sep 15, 2021

Yep - noted above

My automation rule runs only indicate in addWatcher {{issue.fields.People.accountId}}.

Definitely {{issue.fields.People.accountId}} should be default functionality 

{{issue.fields.People.displayName}} - Error watching issues

{{issue.fields.People.Name}} No actions were performed.

I've attempted to do this a ton of ways based on previous and this set of answers, but I still am not getting watchers added. It says "success" but no actions performed. HELP! :)

Automation.png

John M Funk Community Leader Feb 02, 2022

Use displayName instead of Name

Forgot to specify that this is a company-managed project.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Software

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

14,632 views 37 46
Read article

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