Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Scriptrunner - Parse comment with regex and send custom mail to recipients in comment

AB I'm New Here Mar 23, 2021


unfortunately, I have not yet found a suitable answer, so I ask my question directly here:

- Once a comment is created, the comment content should be parsed to users mentioned as @mention.
- If a @mention is found, it should be checked if the user belongs to a certain project role or not.
- If the condition is met (@mention belongs to role), a mail should be sent to this user.

I thought that the rubric "Listener" would fit to this, but you can only store fixed mail addresses there.

What is the best way to proceed?


1 answer

0 votes

Actually, no, you don't have to rely on the fixed email address using the "Send a custom email" script listener.

You can use the "Condition and Configuration" script to set your recipients.

In that script, there is a "mail" variable in the binding.

So you can parse the comment there and then set mail.setTo("your recipients")

Note that when parsing your comment, you'll want to look for [~userName] not @DisplayName since the body of the comment is the underlying wiki format.

Another possibility to explore is to use a "Custom Listener" which allows you to Listen to the "MentionIssueComment" which has a built-in "toUsers()" method that contains the list of users mentioned in the comment.

But that means you would have to code your own interactions with the jira mail systems.

So 2 approaches:

  1. Code your own parsing and leverage the built-in scrirptrunner mail creation
  2. Use the built-in parsing and code your own mail sending

Suggest an answer

Log in or Sign up to answer

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