I have a requirement. When I receive an email in the Jira Inbox from "test@mail.com" with the subject containing the string : test successful for {ABC12345678}
body contains : test successful for {ABC12345678}
It should add a comment to the parent ticket that has the {ABC12345678} value for the custom field.
{ABC12345678} is a custom field value. How to fetch the issue key with this value.
Which approach is best: the Enterprise Email handler or the ScriptRunner Mail handler?
Any guidance, documentation, or examples would be incredibly helpful. Thanks for your time and expertise!
Jira’s default email handler is limited. It can only act when the issue key is already present in the email subject. It cannot extract a value using regex, search a custom field using JQL, and then decide which issue should receive the comment.
With ScriptRunner, this flow is supported:
Extract {ABC12345678} from the subject or body using regex
Use that value in a JQL search against the custom field
Identify the matching parent issue
Add the email content as a comment
This is a standard use case for ScriptRunner custom mail handlers. The official documentation with examples is available here and opens correctly:
That page explains how to build custom mail handlers and how to run JQL inside them, which fits your scenario exactly.
If the issue key is not present in the email, ScriptRunner is the safest and m
Hi @G P N ,
For this kind of requirement, ScriptRunner’s Mail Handler is the better fit.
The built-in Jira (Enterprise) email handler is really meant for simple scenarios only — things like creating a new issue from an email or adding a comment when the issue key is already in the subject. Once you go beyond that, it starts to fall short.
In your case, you need to:
read a value from the email using a pattern,
search Jira using that value in a custom field,
and then decide what to do based on the result.
That kind of logic just isn’t something the standard email handler can do. ScriptRunner is designed exactly for these situations and gives you the flexibility you need to make this work reliably.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.