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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Script Listener does not trigger sometimes on Issue Commented

We're trying to create a simple Helpdesk workflow with basic Jira (not Service Desk).

Our current setup uses the generic mail handler to "Create new issue or add comment", and we have a "Fast Track transition" listener act upon comments if current status == "To Do", the transition will move the ticket to another state

I noticed that if the email being sent contains only text, then the listener will work and the transition triggers properly. HOWEVER, if the email contains an attachment (or even small images within the email, 5~10kb in size), then the listener does not trigger at all.  That particular event does not even show up in the execution history of the listener, even though the comment created from the email appears in the ticket itself. 

Anyone know what could cause this? 

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 29, 2022

Hi @ys

Could you please share your code and Listener configuration so I can review it and provide some feedback?

Thank you and Kind regards,

Hi Ram,

Here's my listener configuration


Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 03, 2022 • edited

Hi @ys

I have tried to replicate this issue in my environment, but I don't seem to be encountering the issue. I can transition the issue along with the attachments.

Below is a screenshot of my mail handler configuration:-


Below is the sample code that I have tested with:-

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.util.JiraHome
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.service.util.ServiceUtils
import com.atlassian.jira.service.util.handler.MessageUserProcessor
import com.atlassian.mail.MailUtils

def userManager = ComponentAccessor.userManager
def projectManager = ComponentAccessor.projectManager
def issueManager = ComponentAccessor.issueManager
def issueFactory = ComponentAccessor.issueFactory
def commentManager = ComponentAccessor.commentManager
def messageUserProcessor = ComponentAccessor.getComponent(MessageUserProcessor)
def jiraHome = ComponentAccessor.getComponent(JiraHome)

def subject = message.subject as String
def issue = ServiceUtils.findIssueObjectInString(subject) as MutableIssue

if (issue) {

def user = userManager.getUserByName('admin')
def reporter1 = messageUserProcessor.getAuthorFromSender(message) ?: user
def project = projectManager.getProjectObjByKey('MOCK')

def issueObject = issueFactory.issue
issueObject.setIssueTypeId(project.issueTypes.find { == 'Bug' }.id)
issue = messageHandlerContext.createIssue(user, issueObject) as MutableIssue

def attachments = MailUtils.getAttachments(message)

def issueDescription = new StringBuilder(issue.description).append('\n')

attachments.each { it ->
def file = FileUtils.getFile(it.filename) as File
messageHandlerContext.createAttachment(file, it.filename, it.contentType, user, issue)

commentManager.create(issue, user, 'This is a sample', true)

issueManager.updateIssue(user,issue, EventDispatchOption.DO_NOT_DISPATCH,false)

log.warn '=======>>>> Mail Read <<<<======='

Please note that the sample code provided is not 100% exact to your environment. Hence, you will need to make the required modifications.

In my environment, I am not using any mail servers. So to test this, I have used the sample code above for this test case to read the *.eml file from the <JIRA_HOME>/import/mail folder. 

If you observe in the code, I have included:-

def commentManager = ComponentAccessor.commentManager
commentManager.create(issue, user, 'This is a sample', true)

So once the ticket is created, it will also include a comment, which will automatically cause the issue to transition to the Testing status.

For the Listener, I am using the same configuration that you have shared, i.e.:-


Below are a few test screenshots for your reference:-

1. The email file is added to the <JIRA_HOME>/import/mail as shown below:-

mail_folder (1).png

2. Once the mail handler is executed, the mail folder is cleared, and the issue is created, as shown below.


If you observe, the issue is created with attachments and can transition to the Testing status without any issues.

I suggest you try to re-test this in your environment and ensure all your other plugins except for ScriptRunner are temporarily disabled before running the test.

Also, please note that I have run this test with the latest version of ScriptRunner, i.e. 7.4.0.

I hope this helps to solve your question. :-)


Thank you and Kind regards,


Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events