Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,639,539
Community Members
 
Community Events
196
Community Groups

Automation Help: Add watcher when user mentioned in comments

Hi Jira Community,

 

Looking for some help using the native automation tools in Jira Cloud to create automation where if a user is mentioned/tagged in the comments section, they'll be added as a watcher for future issue updates. My thought process here is that if a user is tagged, it's likely they are then impacted or associated with the issue and may want updates on that particular issue. Do I need to add a specific JQL condition after "Comment is the main action" rule trigger? Any help would be greatly appreciated! 

2 answers

2 accepted

2 votes
Answer accepted
Bill Sheboy
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.
Aug 30, 2022 • edited Feb 15, 2023

Hi @Mateus Almeida -- Welcome to the Atlassian Community!

Until such a feature is built into Jira Cloud, what you can try is creating an automation rule, triggered on Issue Commented, extract the mentioned users' accountId values, and then add them as watchers.  To do this, you will need...

  • to use a regular expression to get the accountId values, for example...
{{issue.comments.last.body.split(" ").match("(accountId:.*)]").remove("accountId:")}}
  • a condition test to check for empty values
  • an advanced branch to iterate over the values, and
  • an action to add the watchers.

Kind regards,
Bill

 

UPDATED: Another community member noted my rule did not handle multiple mentions on the same text line, and so I revised this one to first split on spaces before searching for the mention-markup information.

I have tried the above which hasn't worked, note that the project is using issue security 

Trying to add @mention and then  add this to the watcher as to selecting a user.

 

The SL has a watcher 

Here's the rule

When: Issue commented           Comment Type: Comment on the main action
Then: Create variable             Variable name: varAddWatcher  Smart Value: {{issue.comments.last.body.split(" ").match("(accountid:.*)]").remove("accountid:")}}

Advanced compare condition:   First value: varAddWatcher  Condition: does not equal Second Value: empty
Then: add Watcher   {{varAddWatcher}}
Bill Sheboy
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.
Aug 25, 2023

Hi @Test work 

Please review the suggested solution as you appear to be missing the part to use an advanced branch to iterate over the values.

As an alternative, I believe you may also try adding them in one step using advanced edit with JSON.

Kind regards,
Bill

 

See the screen shot enclosed which i have used condition and Advanced Branching.

The other issue is the watcher- If I mention a person , that person should be added into the watcher field, the option of action doesn't work.

Bill Sheboy
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.
Aug 29, 2023

Do you see the red exclamation mark in your action to Add Watchers?  There is something wrong with that action.  Please review that to find the problem, and if you are unable to find it, post an image of your Add Watcher action so the community can try to help.

Based upon your rule, you should be using the Variable Name defined in the advanced branch: {{WhatSmartvaluesshouldbeused}}

And remember that smart values are name, spacing, and case-sensitive.  So it must exactly match your defined variable name.

I get the red exclamation mark  as I left that blank - however I don't want to insert a name.

If I @ mention in the comment, then that name should be added to the watcher 
See the additional screen

Bill Sheboy
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.
Aug 29, 2023

To use that action, you must enter something.

The original question for this thread was to add watchers based on mentions in the comments.  And all of the rule logic suggested up to this point was so the smart value can be entered in the Add Watcher action.

If you now want something else, I suggest creating a new question, with a new post, and clearly describe what you are trying to accomplish.  Thanks!

Sure, Thank you for your support Bill

0 votes
Answer accepted
Summer.Hogan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Aug 30, 2022 • edited

@Mateus Almeida - are you using server or cloud? If you are using server, this feature has been enabled where @mentions on comments make the mentioned user a watcher. In cloud, there is a suggestion open in the Jira Cloud project that is in the "Reviewing" status. See here: https://jira.atlassian.com/browse/JRACLOUD-31869. I voted for this feature for you.

At this point in cloud, @mentions are used to just reach out to someone once. Here is some more information: https://www.atlassian.com/blog/jira-software/using-watchers-and-mentions-effectively 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events