How to trigger automation action if comment contains user mention (@mention)?

Michael Buechele March 13, 2020

Hi,

I try to trigger a notification only when a comment does (or does not) contain a @mention.

What I tried so far:

condition.PNG

Unfortunately, this does not work.

Any ideas?

 

Thanks,
Michael

3 answers

2 accepted

5 votes
Answer accepted
Alex F April 7, 2020

Hi Michael, I created the similar topic and at the moment I found part of the answer. To trigger an action when a comment contains (or does not) a mention you should use the following regular expression:

\[~accountid:.+\]

Finally, if you want a rule to trigger when a mention is present in a comment body, it should look like this:

Jira automation 2.png

Petr A October 12, 2020

Hi @Alex F ! Tell me if you can create a condition that will track the comment for the words "thank you". For example, if the comment begins with "Thank you". Or it only consists of "thank you".

 

Thanks))

Like E.M. Stegehuis likes this
Alex F January 19, 2021

Hi @Petr A! I believe you should use something like this:

 

Jira 1.png

Like Petr A likes this
Chuks Ekwere February 4, 2021

Hi @Alex F - how do I configure this to work for when a specific user is mentioned in the comment?

 

cheers

Like Mukesh Agarwal likes this
Aleksander Altberg October 18, 2022

@Alex F I'm curious about this too.

I'm interested in triggering automations based on specific user mentions in comments.

How does the \[~accountid:.+\] syntax work, exactly? And is there a way to specify and check for a specific user mention?

Alex F October 19, 2022

Hi guys,

It's enough simple - you should use the following expression in your Advanced compare condition step:

\[~accountid:ACCOUNT_ID\]

Where ACCOUNT_ID is the identifier of the account, at the mention of which, you want to perform some action. For instance, it may look like this:

\[~accountid:5bed54d183247b27210b85a5\]

You can easily find the desired ACCOUNT_ID, just go to your list of users in Jira, open the profile of the user you want, and copy the identifier in the URL bar, which looks something like this:

2022-10-19_17-37-14.png

As a result, your condition should look like this:

2022-10-19_17-38-56.png

P.S. You can also do this not using the regex match, as there is no need to search for all occurrences of the pattern, but you won't really notice any difference, so this is the solution you can use.

0 votes
Answer accepted
Michael Buechele April 7, 2020

Thanks Alex!
Your solution works perfectly for case "contain".


And this is my solution for case "does not contain":

negation.PNG

0 votes
Alex F April 7, 2020

Hi Michael, you can find the answer here.

Suggest an answer

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

Atlassian Community Events