Script Runner 3.0 Custom CannedScripts not storing params


In testing with Groovy 3.0.5/JIRA 6.3.6.  We have a number of CannedScripts with custom parameters in them that we are testing for en eventual rollout on a production server, but so far we've been unable to get the parameters, and even more recently, the PostFunction, to ''stick'' (or so to speak)

Initially the script was displaying in the postfunction, but no matter what I entered in the fields the data would be discarded and we'd get back the BuiltinScriptErrors that we'd added to validate the entries, essentially telling me that all of the fields were empty.  Injecting logs showed that during the doValidate in the script, none of the parameters has values.

I'm experiencing even stranger behavior now, Once the values are submitted in the postfunction parameters, it doesn't even save the script at all, just bring us back to the ''Select Script'' page and it's not even saving the fact that a script was selected.  

I upgraded to 3.0.6 with no change.  I tried to copy one of the existing builtin scripts and renamed the class and filename, that script is working just fine, eveything is saving properly.  I tried to edit that script by changing the parameter names and types by the ones in my custom script, and I got the same behavior in my custom script.

At this point i've simplified my custom script down as much as possible to determine the source of the problem but still no change, there is nothing that I can see that could be causing this problem.  

Any help would be appreciated, i'm entering the said test script in its entirety.

Many thanks, 


package com.onresolve.scriptrunner.canned.jira.workflow.postfunctions
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.canned.CannedScript
import com.onresolve.scriptrunner.canned.jira.utils.CannedScriptUtils
import com.onresolve.scriptrunner.canned.jira.utils.WorkflowUtils
import com.onresolve.scriptrunner.canned.util.BuiltinScriptErrors
import com.onresolve.scriptrunner.canned.util.SimpleBuiltinScriptErrors
import groovy.util.logging.Log4j
class TestScript2 implements CannedScript {
    def projectManager = ComponentAccessor.getProjectManager()
    def indexManager = ComponentAccessor.getIssueIndexManager()
    public static final String FIELD_LINK_TYPE = 'Parent_Issue_Link_TypeID'
    public static final String ISSUE_TYPE = 'IssueType'
    public static final String PROJECT = 'project'
    String getName() {
        return "The Create Task from Approval"
    public String getHelpUrl() {
        return ""
    String getDescription() {
        return "Made by ME<br>"
    List getCategories() {
    List getParameters(Map params) {
                        Name: ISSUE_TYPE,
                        Label: "IssueType",
                        Type: "list",
                        Description: """Select the right issue type to create ;""",
                        Values: CannedScriptUtils.getAllIssueTypes(true)
                        Name: FIELD_LINK_TYPE,
                        Label: "Parent_Issue_Link_TypeID",
                        Type: "list",
                        Description: """Please enter the Parent Issue link type that is used.""",
                        Values: CannedScriptUtils.getAllLinkTypes(true)
                        Name: PROJECT,
                        Label: "Project",
                        Type: "list",
                        Description: """Please enter the Project that is used.""",
                        Values: CannedScriptUtils.getProjectOptions(true)
    public BuiltinScriptErrors doValidate(Map params, boolean forPreview) {
        BuiltinScriptErrors errorCollection = new SimpleBuiltinScriptErrors()
        if (!params[ISSUE_TYPE]) {
            errorCollection.addError(ISSUE_TYPE, "You must provide an IssueType.")
        if (!params[FIELD_LINK_TYPE]) {
            errorCollection.addError(FIELD_LINK_TYPE, "You must provide a linktypeID.")
        if (!params[PROJECT]) {
            errorCollection.addError(PROJECT, "You must provide a project.")
    Map doScript(Map params) {
        log.warn('Test string')
    String getDescription(Map params, boolean forPreview) {
    public Boolean isFinalParamsPage(Map params) {

3 answers

1 accepted

1 vote

Yeah this is super-nasty and not easy to spot. I changed the constants to this and it worked:

    public static final String ISSUE_TYPE = 'FIELD_ISSUETYPE'
    public static final String PROJECT = 'FIELD_PROJECT'

basically the problem is that IssueType is the name of a parameter and the label of a field, and the javascript is pulling the issue type displayed option rather than the value in the select list.

Basically just change it like I have and you should be ok.

You, sir, are a Gentleman, and a Scholar.

0 vote

I'll check this out some time tomorrow... it;s going to be something trivial. It;s just your own canned scripts you are having problems with right? The script/class file is in the correct directory under your scripts dir (ie matching the package)?

Thanks for the help! Yes, I imagine it's something very small in them, but I can't for the life of me figure out what. They're in the correct directory, in home/scripts/com/onresolve/scriptrunner/canned/jira/workflow/postfunctions/ (doublechecked just to be sure)

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,189 views 13 19
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot