JIRA - ScriptRunner Simple Scripted Validator: Custom Field Not Equal to Default Value Edited

Hi All,

My use case requirement is that only issues of the Story type must have non-default values for 2 specific custom fields before it can be moved in the workflow. The default value for each is set to None.

Requires UI Scrub: None/Yes/No

Docs Impact: None/Yes/No

I'm trying to use the ScriptRunner Simple Scripted Validator to do this, but the script seems to always return false, even if Yes/No is selected.

Here is the script, any ideas? I'm simply using one script for each and just changing the name.

Pardon my syntax, feel free to correct as I'm not too familiar with Java.

if (issue.issueType.name == 'Story')
if (cfValues['Requires UI Scrub']?.value != 'None')
return false
else return true
else return true


Here is the payload from the ScriptRunner logs:

    "canned-script": "com.onresolve.scriptrunner.canned.jira.workflow.validators.SimpleScriptedValidator (java.lang.String)",
    "class.name": "com.onresolve.jira.groovy.GroovyValidator (java.lang.String)",
    "issue": "SWTP-13 (com.atlassian.jira.issue.IssueImpl)",
    "passesCondition": "true (java.lang.Boolean)",
    "transientVars": {
        "issue": "SWTP-13 (com.atlassian.jira.issue.IssueImpl)",
        "configuration": "com.opensymphony.workflow.config.DefaultConfiguration@627a65ad",
        "proj": "Project: SWTP (com.atlassian.jira.project.ProjectImpl)",
        "project": "[GenericEntity:Project][name,Stephen Williams Test Project][assigneetype,3][description,][projecttype,software][id,15606][counter,5][avatar,11303][originalkey,SWTP2][url,][lead,stephen.williams][key,SWTP] (org.ofbiz.core.entity.GenericValue)",
        "currentSteps": "[SimpleStep@1[owner=, actionId=0, status=open]] (java.util.ArrayList)",
        "store": "com.opensymphony.workflow.spi.ofbiz.OfbizWorkflowStore@7c32f7bf",
        "descriptor": "com.atlassian.jira.workflow.ImmutableWorkflowDescriptor@28c7d081",
        "userKey": "stephen.williams (java.lang.String)",
        "originalAssigneeId": "null (org.codehaus.groovy.runtime.NullObject)",
        "entry": "com.opensymphony.workflow.spi.SimpleWorkflowEntry@4c34ba63",
        "context": "com.opensymphony.workflow.basic.BasicWorkflowContext@546d7c7a",
        "originalissueobject": "SWTP-13 (com.atlassian.jira.issue.IssueImpl)",
        "actionId": "11 (java.lang.Integer)",
        "pkey": "SWTP (java.lang.String)",
        "transaction": "com.atlassian.jira.transaction.TransactionSupportImpl$TransactionImpl@584e9cbd"
    "log": "org.apache.log4j.Logger@59e178c9",
    "invalidInputException": "[InvalidInputException: [Error map: [{}]] [Error list: [[You cannot move to Assigned until you select 'Yes' or 'No' for Requires UI Scrub in the Edit screen.]]] (com.opensymphony.workflow.InvalidInputException)"


We are using JIRA Server. Thanks!

1 answer

Hi Stephen,

So what is happening is that the None value is actually the no value or null value. Therefore your validator and supposing that the fields you want to check is a radio button or a select list, should be something like 

if (issue.issueType.name == "Story") { 
return cfValues['RadioButtons']?.value && cfValues['SelectListA']?.value


The best thing to try in order to troubleshoot cases like that, is to add some debug messages in order to see what value the field has during the transition. Something like 

def radioButtonValue = cfValues['RadioButtons']?.value
log.warn "Radio button value is $radioButtonValue

and check your logs to ee the value and then eidt your validator...

Hope that helps.



Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Jira

Updates to jira.atlassian.com give you visibility into what's coming in Jira Server and Data Center

Hello, Community! My name is Gosia and I'm a Product Manager on Jira Server and Data Center here at Atlassian. Since 2002 when we launched our public issue tracker, jira.atlass...

552 views 1 14
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