Auto-Add Watchers When User Is Mentioned

Summary

This article is being used to demonstrate how to automatically add Watchers to Jira Issues when a User is mentioned in a comment, using Automation.

Please note that you can make this Rule either a Single Project, Multiple Project, Project Type, or a Global Automation Rule, depending on your preference. But bear in mind our: Best Practices for Optimizing Automation Rules 

Screenshot 2023-12-11 at 5.01.50 PM.png

Setup

Configure your Automation Rule Trigger to run on the Comment Types that you prefer the @mentioned Users to be added as a Watcher on. I configured my Automation Rule Trigger to Trigger on All comments.

Screenshot 2023-12-11 at 4.49.04 PM.png

Then, Create a Variable Automation Action that will use any variable name, with the Smart Value field as: 

{{issue.comments.last.body.split(" ").match("(accountid:.*)]").remove("accountid:")}}

This will look like the following in the Rule, right after the Rule Trigger:

Screenshot 2023-12-11 at 4.52.28 PM.png

After that, we will want to configure an Advanced Compare Condition. This will look at the First Value of the Variable Name that you created and evaluate if there are no watchers on the comment action. In my case that is {{addwatchers}}. That said, if there are no mentions in the comment, then the Rule does not run the Action. If it does, it will execute the Action in the Rule Next. Here is a screenshot of the Advanced Compare Condition:

Screenshot 2023-12-11 at 4.56.19 PM.png

Lastly, we will configure the Add Watchers Automation Action, using the {{addwatchers}} Smart Value:

Screenshot 2023-12-11 at 4.58.57 PM.png

This will all look like the following in the Automation Rule Flow:

Screenshot 2023-12-11 at 4.59.27 PM.png

I hope this helps!

-Christian B.

Relevant Documentation:

1 comment

Laurie Sciutti
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 21, 2024

Great article, @Christian Beaulieu !

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events