Script runner: issues after upgrade from Jira 4.4 to jira 6.3


Until now, we had JIRA 4.4.3 with Groovy Runner 2.0.7. We upgrade our instance in JIRA 6.3.15 with Groovy Runner 3.0.16.

The problem is with our previous version, we implemented a new functionlity in the plugin Groovy Runner 2.0.7: A SimplePostfunction.groovy, delivered by Henning Tietgens.

This functionnality was used to add groovy script in workflow postfunctions via the JIRA interface. For more details, you can refer to this ticket:


My issue: The post function is used a lot of time, but when I try to see the workflow configuration I encounter an "Internal error" page. We found errors in logs:

"java.lang.Exception: Class com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SimplePostfunction could not be found, or could not be compiled  at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.ensureScriptCompiled(ScriptRunnerImpl.groovy:592)  at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.validateAndRunCannedInternal(ScriptRunnerImpl.groovy:394)  at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runCanned(ScriptRunnerImpl.groovy:371)"


I cannot update the configuration of workflows because I can't access to the JRA interface, so I try to solve the issue by adapting the groovy class but without sucess.


Please help


PS: I have added the script in attachment

1 answer

1 accepted

2 votes
Accepted answer

Try this

package com.onresolve.scriptrunner.canned.jira.workflow.postfunctions

import com.atlassian.jira.issue.MutableIssue
import com.onresolve.scriptrunner.canned.CannedScript
import com.onresolve.scriptrunner.canned.jira.utils.ConditionUtils
import com.onresolve.scriptrunner.canned.util.BuiltinScriptErrors
import com.onresolve.scriptrunner.canned.util.SimpleBuiltinScriptErrors
import com.opensymphony.util.TextUtils
import org.apache.log4j.Logger

class SimplePostfunction implements CannedScript {

    Logger log = Logger.getLogger(SimplePostfunction.class)
    public static

    String getName() {
        "Simple scripted postfunction"

    String getDescription() {
        "Runs a simple embedded script"

    List getCategories() {

    List getParameters(Map params) {
                        Name       : FIELD_ADDITIONAL_SCRIPT,
                        Label      : 'Script',
                        Description: "Enter any customisations to the issue, e.g. hard-coding specific field values.",
                        Type       : "textarea",
                        cssClass: "CodeMirror CodeMirrorSmall",
                        Examples   : [
                                "Set issue summary": "issue.summary = \\'Cloned issue\\'",
                                "Set custom field" : "def cf = customFieldManager.getCustomFieldObjects(issue).find { == \\'MyCustomFieldType\\'}\\n" +
                                        "issue.setCustomFieldValue(cf, \\'my value\\')"


    public BuiltinScriptErrors doValidate(Map params, boolean forPreview) {
        BuiltinScriptErrors errorCollection = new SimpleBuiltinScriptErrors()
        if (!params[FIELD_ADDITIONAL_SCRIPT]) {
            errorCollection.addError(FIELD_ADDITIONAL_SCRIPT, "You must provide an additional script.")

    Map doScript(Map params) {
        MutableIssue issue = params['issue'] as MutableIssue
        Map transientVars = params['transientVars'] as Map

        Boolean doIt = ConditionUtils.processCondition(params[ConditionUtils.FIELD_CONDITION] as String, issue, false, params)
        if (!doIt) {
            return [:]

        ConditionUtils.doAdditional(params[FIELD_ADDITIONAL_SCRIPT] as String, issue, [transientVars: transientVars])


    String getDescription(Map params, boolean forPreview) {
        getName() + " : Condition: <pre>" + TextUtils.htmlEncode(params[ConditionUtils.FIELD_CONDITION] as String) + "</pre> Script: <pre>" + TextUtils.htmlEncode(params[FIELD_ADDITIONAL_SCRIPT] as String) + "</pre>"

    public Boolean isFinalParamsPage(Map params) {


and adapt the path of the script file according to the package (com/onresolve/scriptrunner/canned/jira/workflow/postfunctions/)



Also check the location of the file, it should be under <jira-home>/scripts (in the correct package directory), and not under web-inf/classes, or anywhere else.

Thank you Jamie and Henning. You're the best. :) The fix of Henning works very well and solve my issue.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,719 views 3 11
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you