automation to add automatically a watcher that was tagged / mentioned in a task

Eran Roiter
Contributor
June 26, 2024

 

 

How can i set automation to add automatically a watcher that was tagged / mentioned in a task ?

 Any ideas ?

 

Thanks 

 

1 answer

0 votes
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.
June 26, 2024

Hi @Eran Roiter 

This is frequent question, and if you search in community posts you may find several different solutions.  To help focus that a bit...

Where are you checking for mentions: the description, comment, etc.?  Each one may need a separate rule to add watchers.

How many mentions do you want to handle?  Adding one can be done with the Manage Watchers action, and adding multiple will require creating a list of them first.

 

Let's assume you are checking comments and adding one-to-many watchers.

When a mention happens, that appears in a text field like this:

[~accountid:userAccountIdValue]

That expression can be parsed to extract the account id values to use and add watchers.

  • trigger: issue commented
  • smart value condition: to check if any mentions happened
    • first value: {{issue.comment.last.body.split(" ").match("\[~accountid:(.*)\]").distinct.size|0}}
    • condition: greater than
    • second value: 0
  • manage watchers
    • add with comma-separated values list
{{issue.comment.last.body.split(" ").match("\[~accountid:(.*)\]").distinct.join(",")}}

That works by splitting apart the comment to simplify searching with match(), find the account id values, remove any duplicates with distinct if the same person is mentioned multiple times, and then join them together with commas.

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events