script runner validation

Tom Lister January 21, 2016

I am trying to check if a comment is entered if a radio buttons is set to Yes in a simple script validator

cfValues['Will the overnight batch be affected']?.value != 'Yes' || cfValues['Effect on Batch?']

when No it transitions

when yes i get error pop up workflow error "It seems that you have tried to perform an illegal workflow operation."

i guess its because validator is now returning false,

how do i get an error message against field

JIRA 6.2.7

ScriptRunner 3.0.2

4 answers

1 vote
Thanos Batagiannis _Adaptavist_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2016

Sorry I misunderstood the question. I suppose now you do not have a screen during the transition. So the solution is to associate a screen during the transition and then make sure that you set to display the error message in a field that exists in the screen that you just configured. Please let me know if you need further assisatnse 

Mark Geddes January 21, 2016

yes that works - thanks!

I assumed the errors would be reported on the screen starting the transition

0 votes
Mark Geddes January 21, 2016

Hi Thanos

If i just 'return false' i get the workflow error pop-up instead of the configured field error message

0 votes
Thanos Batagiannis _Adaptavist_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2016

I would suggest to use 'if' cases in order to test them, and then you can convert them easier to logical expressions more information on groovy truth.

0 votes
Tom Lister January 21, 2016

correction - ScriptRunner 3.0.7

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events