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

groovy.lang.MissingMethodException: No signature of method: addMessage()

Anita Kalidoss August 31, 2022

I have a scriptrunner automation script that adds an email address(extracted from ticket description) to a customField. This script will be triggered(through project automation) when creating a new ticket. I have used the the utility functions available for writing information and error messages to the Automation for Jira audit log- addMessage(String message) and addError(String errorMessage). Here is the link to documentation:

I have a built-in test runner script to test the above scriptrunner automation script. I have followed the documentation from this link :

When I run the built-in test runner script, I get the below exception :


No signature of method: automationScriptName.addMessage() is applicable for argument types: (String) values: [XXXX].

If I comment the addMessage(String message) line on the automation script, the groovy.lang.MissingMethodException does not occur and my test will pass. Commenting those line is the temporary workaround that I have.

Wondering why the utility functions - addMessage(String message) and addError(String errorMessage) not supported when the script is called from the test runner framework ?

Any insight on this issue is greatly appreciated.



Anita Kalidoss





1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
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.
September 1, 2022

Hi @Anita Kalidoss

Could you please share a screenshot of your Automation configuration?

I suspect (I may be wrong) that you are invoking the method as:-


Could you instead try to invoke like:-

addMessage("<Add Your Message Here>")

It would be best if you could share your code so I can better understand the problem.

Some examples are provided in the latest ScriptRunner Documentation.

Thank you and Kind regards,


Anita Kalidoss September 2, 2022

Hi Ram,

I'm not invoking the method as automationScriptName.addMessage(). Please see the attached screenshot for automation configuration, automation-script code and the unit test code.

Automation Configuration.png

Automation Script code: saveSenderEmailToIssue.groovy

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder

def emailPattern = /[_A-Za-z0-9-]+(.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(.[A-Za-z0-9]+)*(.[A-Za-z]{2,})/
def description = "${issue.description}"
def lastLine = description.substring(description.indexOf("[Created via e-mail received from:")).split(" ")
def email = lastLine[lastLine.size() - 1]
email = email.substring(0, email.length() - 1)

email = email.substring(1, email.length() - 1)

addMessage("Email address found: " + email)
CustomField senderCf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Sender");
def changeHolder = new DefaultIssueChangeHolder()
senderCf.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(senderCf), email), changeHolder)

   addError("Email address might be invalid or missing: " + email)


Test Runner Built-In unit test code: saveSenderEmailToIssueIT.groovy


import com.atlassian.jira.bc.issue.IssueService
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.IssueManager
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.fields.CustomField
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserManager
import com.onresolve.scriptrunner.canned.common.admin.SrSpecification
import spock.lang.Shared
import org.slf4j.LoggerFactory

//TODO add some description
class SaveSenderEmailToIssueIT extends SrSpecification {

IssueService issueService = ComponentAccessor.getComponent(IssueService)

IssueManager issueManager = ComponentAccessor.issueManager

ApplicationUser currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser

UserManager userManager = ComponentAccessor.getUserManager()

JiraHome jiraHome = ComponentAccessor.getComponent(JiraHome)

def scriptRunner = ScriptRunnerImpl.getScriptRunner()

def "Save Email address to Sender Custom Field"() {
def logger = LoggerFactory.getLogger(this.class)
logger.debug("Inside Setup")
long newProjectId = 10201
def issueTypeID = "10001"
ApplicationUser reporter = userManager.getUserByName("external_user")

logger.debug("Inside Setup and")
def issueInputParams = issueService.newIssueInputParameters()
issueInputParams.with {
projectId = newProjectId
priorityId = "3"
description = "test desc updated" + "\r\n[Created via e-mail received from:]"
summary = "Test Updated saveSenderEmailAddressToIssue.groovy"
issueTypeId = issueTypeID
reporterId =


def createValidationResult = issueService.validateCreate(currentUser, issueInputParams);


IssueService.IssueResult createResult = issueService.create(currentUser, createValidationResult)
def createdIssueKey = createResult.getIssue().key
MutableIssue newIssue = createResult.getIssue()

issueManager.isExistingIssueKey(createdIssueKey) == true


//Use this line to test calling the automation script from the unit test
scriptRunner.runFileAsScript(new File("automation-scripts/saveSenderEmailAddressToIssue.groovy"), [issue: newIssue])
CustomField senderCf = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_11300")
def senderEmailAddress = senderCf.getValue(newIssue)

senderEmailAddress == ""


Error displayed in Test runner Built-in script when saveSenderEmailToIssueIT  is run:

Run 1
Failures 1
Error Save Email address to Sender Custom Field(
No signature of method: saveSenderEmailAddressToIssue.addMessage() is applicable for argument types: (String) values: [Email address found:]

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.
September 8, 2022

Hi @Anita Kalidoss

I have tried to run a basic test using Jira's Automation, and I don't seem to be encountering any problems.

Below is the code that I have tested with:-

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption

import java.util.regex.Pattern

def description = issue.description
def customFieldManager = ComponentAccessor.customFieldManager
def issueManager = ComponentAccessor.issueManager
def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser

def sampleText = customFieldManager.getCustomFieldObjectsByName('Sample Text Field').first()

def pattern = Pattern.compile("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}")
def matcher = pattern.matcher(description)

if (matcher.find()) {
issueManager.updateIssue(loggedInUser, issue, EventDispatchOption.DO_NOT_DISPATCH, false)

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

Below is a screenshot of my automation configuration:- automation_config_1.png

In my environment, I am not adding any *Then* options.

Below are a few screenshots for your reference:-


I hope this helps to answer your question. :)

Thank you and Kind regards,


Like Vikrant Yadav likes this
Anita Kalidoss September 9, 2022

Hi Ram,

I noticed couple of things:

1) You didn't use the two utility functions available for writing information and error messages to the Automation for Jira audit log - addMessage(String message) and addError(String errorMessage) in your code

2) You are testing your code through project automation. MissingMethodException on addMessage(string) won't show up when testing through project automation. I'm testing the code through Scriptrunner Built-In Scripts "Test Runner" option. The MissingMethodException on addMessage(string) shows only when testing the code through "Test Runner" option. I have written a unit test code "saveSenderEmailToIssueIT.groovy"(code attached in my previous response). Below are the screen shots of running the unit test through Test Runner. 

We have a unit test plug-in created(followed steps in this link: to include the unit tests for project automation. This plug-in will allow/support our testing effort to be automated.






Anita Kalidoss September 12, 2022

Hi Ram,

I opened a support case with Adaptavist Scriptrunner on this. -

They confirmed that "there is no public API from A4J that allow us to inject the execution context to execute the script by ourselves".


Thanks for your assistance!

AUG Leaders

Atlassian Community Events