hello
I wonder if it's a bug or not,
I added workflow validator (Simple scripted validator of ScriptRunner).
The validator works as expected at the "create" step but not at the "resolve". If the script returns a false value the transition will be blocked with the error message I have defined. but at "resolve" stage its return default Jira massage:
"It seems that you have tried to perform an illegal workflow operation.
If you think this message is wrong, please contact your JIRA administrators."
In this to transitions there is no configured screen.
Thank you!
Noa
Hi @Noa Masel ,
Welcome to Atlassian Community!
In my understanding, when you opt to use the "Simple scripted validator", you need to add in your code the instructions to display a message explaining the reason that the Validator failed.
See below example from Scriptrunner documentation, where it throws an InvalidInputException exception if the issue has no fix versions during its closure transition.
import com.opensymphony.workflow.InvalidInputException
if (issue.getResolution() == "Fixed" && ! issue.fixVersions) {
throw new InvalidInputException("fixVersions",
"Fix Version/s is required when specifying Resolution of 'Fixed'")
}
Can you include this exception in your validator script and let me know the outcome?
Thank you @Italo Qualisoni [e-Core]
My script is checking if the custom field SR-type filled while user open SR ticket.
My simple script is:
cfValues.get("Service Request Type")?.keySet()?.size() == 2
As I wrote, the validator works as expected at the CEREATE transition, but not at the RESOLVE transition (I added the same validator at the resolve transition because sometimes the ticket opened as bug or task instead of SR, and when I move it to SR the ticket already created and validator doesn't work on the other transition, so before I close the ticket I want to validate if the SR-type field is filled...).
As you can see the massage is not part of the script.
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Noa Masel ,
I was mistaken, you need to throw InvalidInputException when using the "Custom script validator".
My guess is that your transition don't have a screen and this might be part of your issue.
As a test, can you create a Screen containing your "Service Request Type" field and associate this screen in your resolve transition? Let me know if does this fix your issue.
I'm not sure if not working with none screen is a bug or expected behavior, I might need to open a ticket to Adaptavist to get their response on that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same thing here with Power Scripts, started after upgrade to 8.20.6
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Expected. Not giving the user a reason for the failure is the primary reason we usually avoid using validators. It just introduces confusion.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.