Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to make a rule that triggers an action when a user is mentioned in a comment?

I want to create a rule that, for example, makes a web request when a user is mentioned in a comment and I need to get the mentioned user's accountId from the comment. How to achieve this?

2 answers

1 accepted

1 vote
Answer accepted

Here is the answer:

To trigger an action when a comment contains (or does not) a mention you should use the following regular expression:

\[~accountid:.+\]

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

If you want to extract accountId from the mention in the last comment you should use the following smart value:

{{issue.comments.last.body.match("(\[~accountid:.+\])").remove("[~accountid:").remove("]")}}

For example, you can use the smart value in an email body or in a web request to Jira API.

Hi there

This isn't working for me.  The automation rule audit log shows that the rule recognizes that a comment was added, but it doesn't seem to be recognizing the user mention.  Could this be something to do with how our mentions are displayed?  In our setup, when someone is mentioned their name is displayed in format Lastname, Firstname. We are on Jira Server v7.12.3.

Any suggestions please?

Thanks.

Hi,

I'm not sure it should work for Jira Server, I never used it, our deployment type is Cloud, so maybe you need to create a new question.

Like Alex likes this

please try  this regular expression:

\[\~.*?\]

Hey,
that works fine, perfekt.
Now I want, for example, send an E-Mail to that user. Has somebody an Idea how to proceed with the extracted accountId?

Thanks!

Hi @Eva Pfister,

I believe you should make a get request to the Jira API to get an email address for future reference. Here you can find how to do that. And here is the API endpoint you need.

You can access the email address from the API response with dot notation using the following smart value:

{{webhookResponse.body.emailAddress}}

Here you can find more about {{webhookResponse}} smart value.

I was also having an issue using the format: 

\[~accountid:.+\]

 

Instead I was able to do this:

Screen Shot 2020-11-17 at 3.19.37 PM.png

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Posted in Jira Software

Presenting the "Best of 2020" Jira Software roundup!

Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...

7,138 views 8 28
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you