I am running Jira 6.3.3 and the latest Version of Script Runner. I am trying to run a custom validation script on a workflow but it seems not be executed as nothing happens and there are no entries in the log file, even if the script contains syntax errors. I have also tried running the example validator from the website, with the same result. Any suggestions what could be the problem or where to look for further information?
99 little bugs in the code
99 little bugs in the code
Take one down, patch it around
117 little bugs in the code
@Jamie- be merciful :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Radu... it could be any member of the massive development team. But when I found out who, they'll be sorry....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"throw new InvalidInputException" works fine for me fron file and inline script. In 3.0.5:
invalidInputException = new InvalidInputException
will also work (from both).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay. Turns out, I tested the throws variant only from a file not as an inline script, which works file.
Thank you for your help.
I am still curious what to do about the log message, if I try to run a custom script from a file:
/secure/CommentAssignIssue.jspa [onresolve.scriptrunner.runner.ScriptRunnerImpl] Add a script root for this path: /path/to/my/file/script.groovy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@jamie I use Jira 6.3.4 and Script Runner 3.0.4.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Blame it on the developer, right.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What version of the plugin are you using? I think I may have broken that backwards compatibility in one of the most recent releases.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, "throw" works for me. (I have the same problems as Robert)
import org.apache.log4j.Category import com.opensymphony.workflow.InvalidInputException log = Category.getInstance("com.onresolve.jira.groovy.example.testValidator") log.debug("Condition testValidator script running") throw new InvalidInputException("Validation failure")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes it is.
Yes it is. I am using a default workflow in an out of the box Jira with Script Runner.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does using:
throw new InvalidInputException("Validation failure")
work?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And workflow scheme with proper workflow attached to project
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
... and you are on the correct issue type, if WF was not published for all issue types ... ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@RaduYes I am.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you sure you published your workflow? Just making sure ....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am using a Custom Validator and SR version 3.0.4
I am using an absolut path to the script file and tried to run it as inline script as well. Running it from a file I just noticed this message in the log:
/secure/CommentAssignIssue.jspa [onresolve.scriptrunner.runner.ScriptRunnerImpl] Add a script root for this path: /path/to/my/file/script.groovy
Do you have any suggestions how to resolve this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could just add a screenshot. It really depends if you are using "custom validator" or "simple scripted validator". They work differently. "false" is fine for the latter. For the former, try finishing your script with:
throw new InvalidInputException("Validation failure")
what version of SR are you using?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you provide full information how do you add this condition to a workflow?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The following script
import org.apache.log4j.Category import com.opensymphony.workflow.InvalidInputException log = Category.getInstance("com.onresolve.jira.groovy.example.testValidator") log.debug("Condition testValidator script running") invalidInputException = new InvalidInputException("Validation failure")
is executed for me. I got the log and transition was not executed.
Are u sure that you have followed the steps in order to have the custom script validator executed?
In order to make it work you have to:
Hope that helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@KostasTo narrow it down I reduced the code to a bare minimum. My aim was to see if it runs, by having a validator that always fails. I tried a simple
false
which seemed to have worked for older versions and the example from the documentation
import org.apache.log4j.Category import com.opensymphony.workflow.InvalidInputException log = Category.getInstance("com.onresolve.jira.groovy.example.testValidator") log.debug("Condition testValidator script running") invalidInputException = new InvalidInputException("Validation failure")
Neither the validation fail nor the log message is shown.
@JamieI double checked it with a collegue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Make sure the workflow is published, and associated with the project/issue type you are testing with.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you provide your code so we check more in details?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.