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
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.
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:
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:
Lastly, we will configure the Add Watchers Automation Action, using the {{addwatchers}} Smart Value:
This will all look like the following in the Automation Rule Flow:
I hope this helps!
-Christian B.
Christian Beaulieu
JSM Support Engineer 3
Atlassian
Phoenix, Arizona
2 accepted answers
6 comments