Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Groovy Jira Validator fixed Version

Rosana Casilli November 8, 2018

Hi! 

I am trying to create a validation resolved transition that only allows to change to resolved status if fix version is not empty. 

So I tried and wrote the following script in the validator:

 

import java.util.ArrayList;
import java.util.Collection;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.project.version.Version;
import com.opensymphony.workflow.InvalidInputException;

Collection <Version> fixVersions = new ArrayList <Version> ();
Issue issue = issue;
fixVersions = issue.getFixVersions();
if(fixVersions.size() == 0)
invalidInputException = new InvalidInputException("fixVersions","Fix Versions field can not be empty.");

 

When I excecute it, it shows the following error:

 

No such property: issue for class: script1541705492828849500869
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:52)
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
script1541705492828849500869.run(script1541705492828849500869.groovy:9)
fr.gfi.jira.plugins.runner.quercus.ScriptingManagerImpl.doExecuteScript(ScriptingManagerImpl.java:272)
fr.gfi.jira.plugins.runner.quercus.ScriptingManagerImpl.eval(ScriptingManagerImpl.java:382)
fr.gfi.jira.plugins.runner.rest.PHPRunnerRest.run(PHPRunnerRest.java:20

 

Why is showing the error "No such property: issue for class"?

I appreciate your help. 

 

thanks in advance.

Ro

 

PS: I am using Jira Server and I have installed Code Runner Groovy. I do not have Script Runner or any payed suit, because the company doesn't want to spend money in components

 

1 answer

1 accepted

0 votes
Answer accepted
Tom Lister
Community Champion
November 8, 2018

Hi @Rosana Casilli

the docs for Code Runner by Haithem souala show examples using $issue

is that the plugin you are using?

it could be just


Collect<Version> fixVersions = $issue.getFixVersions();

Rosana Casilli November 12, 2018

Thank you so much!! this worked!!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events