I've created a simple validation script (for this test) which stops an issue/record transition if the original-estimate (time tracking fields) value is greater than 2 hours. It's implemented as a Validator on my custom Workflow and is coded as:
issue.originalEstimate <= 7200
Problem 1, I set the associated Script Validator Field as Original Estimate and make the User confirm the Estimate via a Transition Screen. Upon click the associated button the validation fires and when the condition above returns false nothing occurs on the UI but the atlassian-jira.log captures a series of errors (shown below). Entering a valid estimate (<2hrs) seems the transition complete as expected. Note, if I leave the Script Validator Field set to <blank> the expected functionality works, i.e. either an error message is displayed or the transitions occurs when correct. Any ideas?
Problem 2, I'd like this validation to not reply on a transition screen but when no screen is specified the error message I added is displayed in a dialog but also a message about "an illegal workflow operation" and "contacting the Jira admin" (see below) How do I get rid of these messages. Note, this dialog/validation also only works when the Script Validator Field is set to <Blank>
The dialog message
Assignee does not have enough free time
It seems that you have tried to perform an illegal workflow operation.
If you think this message is wrong, please contact your Jira administrators.
Problem 1 Log
2018-10-04 12:30:58,153 http-nio-8080-exec-10 DEBUG 905646 750x71146x1 187qt3b 127.0.0.1 /secure/CommentAssignIssue.jspa [c.o.j.groovy.groovyrunner.spring] BeforeInstantiation [bean=com.onresolve.jira.groovy.GroovyValidator, type=com.onresolve.jira.groovy.GroovyValidator]
2018-10-04 12:30:58,154 http-nio-8080-exec-10 DEBUG 905646 750x71146x1 187qt3b 127.0.0.1 /secure/CommentAssignIssue.jspa [c.o.j.groovy.groovyrunner.spring] AfterInitialisation [bean=com.onresolve.jira.groovy.GroovyValidator, type=com.onresolve.jira.groovy.GroovyValidator]
2018-10-04 12:30:58,262 http-nio-8080-exec-10 ERROR 905646 750x71146x1 187qt3b 127.0.0.1 /secure/CommentAssignIssue.jspa [webwork.util.ValueStack] query="/tabsWithErrors" {[id="null" type="5" values=""]} {[id="tabsWithErrors" type="8" values=""]}
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at webwork.util.InjectionUtils$DefaultInjectionImpl.invoke(InjectionUtils.java:70)
at webwork.util.InjectionUtils.invoke(InjectionUtils.java:56)
at webwork.util.ValueStack.findValue(ValueStack.java:417)
at webwork.util.ValueStack.findValue(ValueStack.java:216)
at webwork.view.taglib.WebWorkBodyTagSupport.findValue(WebWorkBodyTagSupport.java:62)
at webwork.view.taglib.ParamTag.doEndTag(ParamTag.java:59)
at jsp.secure.views.issue.commentassignissue_jsp._jspx_meth_ww_005fparam_005f3(commentassignissue_jsp.java:1876)
at jsp.secure.views.issue.commentassignissue_jsp._jspx_meth_ww_005fcomponent_005f0(commentassignissue_jsp.java:1772)
at jsp.secure.views.issue.commentassignissue_jsp._jspx_meth_page_005fapplyDecorator_005f0(commentassignissue_jsp.java:609)
at jsp.secure.views.issue.commentassignissue_jsp._jspx_meth_ww_005fif_005f1(commentassignissue_jsp.java:528)
at jsp.secure.views.issue.commentassignissue_jsp._jspService(commentassignissue_jsp.java:171)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
<the rest of the log removed...>
That's correct - similar to the 'Fix Version' example
In terms of 'screen' I have tried a Transition screen and also the Create screen.
N.B. The 'Original Estimate' field is part of the 'Time Tracking' field.
I think the problem is the Field setting on the dialog provided - if I leave that blank it seems to work on both screen scenarios.
Hi Garry,
Let me get this straight.
1. You have a transition screen with 'Original Estimate' field on it.
2. You have a scripted validator on this transition which checks if the value entered in 'Original Estimate' is less than 2 hours and if it isn't you want an error message displayed on screen?
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.