Hi,
I know it is not possible to find the @ mentioned user in general. I would like to create an automation rule, where in the comments is searched for any accountId (so far it worked) and then set these accountid as watcher. Unfortunately I am not able to find the right smart value or any working smart value except {{comment.author}}.
My query starts with:
{{comment.body}} contains regex {{assignee.accountid}}
Now I need the "Add watcher" part.
Can anybody help we with this issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Rixta Padeken
Welcome to the Atlassian Community!
Per your description, I understand that you would like to automatically add a user as a watcher when he is @mentioned in a comment on the issue. Is that correct?
Indeed, the Automation for Jira does not have a simple way to configure it, but we have the following feature request open to allow @mention to be selected as a trigger in automation rules:
We suggest keeping an eye on that suggestion to receive any updates about that.
For now, the only way you can do this is to use regular expression matching. So you could set up a rule as below:
Trigger: Issue commented
Compare condition:
First value:
{{comment.body}}
Matches
Second value:
.*\[\~.*\].*
Action: Manage watchers add users with this smart-value -
{{comment.body.match(".*\[\~(.*)\].*")}}
Basically. when a comment is added and a user is mentioned, this is inserted into the comment as [~username], so t
he smart-value above extracts the username via a regular expression match. You can check more details about this in the documentation below:
A limitation of this approach is that it will only add one user as the watcher (if multiple users are mentioned in a comment). There's no work-around for this at the moment.
Let us know if you have any questions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Petter,
thank you for your fast respond, unfortunatelly it is not working. The picture shows the audit log of the automation rule, after I mentioned somebody in a comment. The user is found but anyhow the watcher cannot be set via accountid? I don't really get it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Petter Gonçalves it's not working for me either, I have the same issue than @Rixta Padeken .
Can you please provide with a working solution ?
Thanks !
Nicolas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yeah, it doesn't work for me either.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi community!
As often is the case for things not built-in for automation rules, you will need to experiment to learn what is possible. For example this worked for me after some experimentation:
{{issue.comments.last.body.match("(accountid:.*)]").remove("accountid:")}}
This works for one mention in the comment. If you expect multiple people to be mentioned, the rule would need to be altered to treat varAddWatcher as a list, and branch over it to add watchers.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
it doesn't work
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @YY Brother
Your comments of "it doesn't work" to not provide enough context for the community to offer help. I suggest that you try:
If that is not possible, please instead consider asking your site admin to submit a ticket to Atlassian support for assistance. You may do that here if you are using a paid license for Jira: https://support.atlassian.com/contact/#/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
==> there is no such jira automation aciton. I tried to add the code as the watcher and the result had an error like
{{issue.comments.last.body.match("(accountid:.*)]").remove("accountid:")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The Create Variable action only exists in Jira Cloud automation rules. Are you using Jira Server/Data Center?
If so, you could try performing the comment parsing and test all at once in the advanced compare condition.
I also respectfully suggest you try writing values to the audit log to confirm if your string parsing is returning the values you expect...before trying to change the watcher field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's really a pity that I don't use Cloud. Thanks for your sugggestion anyway.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.