I am trying to force user to link an issue before they can transition.
Here is the validator I added
Script workflow function : The following fields will require to have their values changed: Linked Issues
It allows me to proceed even though there are no linked issues in the JIRA
Using JIRA 6.1.6 and groovy 2.1.16.
I have also tried "Field has been modified Validator" from JIRA Misc Workflow plugin, and I experience the same result
I've added my own custom Groovy script using ActionContext.getRequest and the functionality meets my requirements. Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes this works. Thanks Jamie. But I need to point out that this canned script does not work:
Script workflow function : The following fields will require to have their values changed: Linked Issues
Maybe it's a moot point because this is an older version of scriptrunner
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Brian,
I have attached an example as shown in the screenshots in the document here which shows how you can add a Simple Scripted Validator to a transition to say the transition can only occur when an issue has one of more linked issues. In the example attached I am blocking the To-Do to In Progress transition when no linked issue is on the issue being transitioned.
The code used for the scripted validator is:
// Issue must have at least one Linked Issue attached to it issueLinkManager.getOutwardLinks(issue.getId()).size() >= 1
If you wish to specify a specific issue type then you can do this using code similar to below for the scripted validator.
// Issue must have a linked issue of the type Duplicate issueLinkManager.getOutwardLinks(issue.getId())*.issueLinkType.name.contains('Duplicate')
I hope this helps.
Thanks
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Kristian, this will work only if an issue is linked previously. I'd like to force linkage during the transition and have added a transition screen with Linked Issues on it. Unfortunately, since the issue is not linked in the database, it will not recognize the linked issue added in the screen.
I'm guessing there is a bug in my original way to do this?
Script workflow function : The following fields will require to have their values changed: Linked Issues
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you placed yout post function so that it is the last post function in the list and appears below the Re-index an issue to keep indexes in sync with the database post function?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you using the simple scripted validator provided by the Script Runner plugin as the two code snippets above are the will work for ensuring a linked pressent before the transition is allowed.
Also can you please share some screenshots of what you have configured and the extracts of the atlassian-jira.log file from when the transition is executed so we can try to help you further.
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Approval Workflow Screen.pngLinking Issue.pngError Received.pngWorkflow Validator.pngSimple Script Screen.png
2016-03-08 11:01:29,922 http-bio-443-exec-3 ERROR cbashyb 661x721x1 1o3blpu 10.46.58.156
/secure/CommentAssignIssue.jspa [atlassian.jira.workflow.OSWorkflowManager] Caught exception while attempting to
perform action 771 from workflow 450381 on issue 'EDD-25' [InvalidInputException: [Error map: [{}]] [Error list: [[You must link a Project JIRA Issue in order to
proceed]]] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:71) at org.codehaus.groovy.runtime.callsite.ConstructorSite.callConstructor(ConstructorSite.java:42) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190) at com.onresolve.jira.groovy.canned.workflow.validators.SimpleScriptedValidator.doScript
(SimpleScriptedValidator.groovy:66) at com.onresolve.jira.groovy.canned.CannedScript$doScript.call(Unknown Source) at com.onresolve.jira.groovy.CannedScriptRunner.runCannedScript(CannedScriptRunner.groovy:63) at com.onresolve.jira.groovy.GroovyRunner.run(GroovyRunner.java:52) at com.onresolve.jira.groovy.GroovyValidator.validate(GroovyValidator.java:47) at com.opensymphony.workflow.AbstractWorkflow.verifyInputs(AbstractWorkflow.java:1512) at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1203) at com.opensymphony.workflow.AbstractWorkflow.doAction(AbstractWorkflow.java:564) at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowActionInsideTxn(OSWorkflowManager.java:954) at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowAction(OSWorkflowManager.java:909) at com.atlassian.jira.bc.issue.DefaultIssueService.transition(DefaultIssueService.java:450) at com.atlassian.jira.web.action.issue.CommentAssignIssue.doExecute(CommentAssignIssue.java:192) <+1>
(ActionSupport.java:165) at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:87) <+7>
(DefaultInterceptorChain.java:39) (NestedInterceptorChain.java:31) (ChainedInterceptor.java:16)
(DefaultInterceptorChain.java:35) (GenericDispatcher.java:225) (GenericDispatcher.java:154)
(JiraWebworkActionDispatcher.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) <+14> (ApplicationFilterChain.java:305)
(ApplicationFilterChain.java:210) (ChainedFilterStepRunner.java:87) (ApplicationFilterChain.java:243)
(ApplicationFilterChain.java:210) (XContentTypeOptionsNoSniffFilter.java:22) (AbstractHttpFilter.java:31)
(ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (HeaderSanitisingFilter.java:44)
(ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (IteratingFilterChain.java:46)
(DelegatingPluginFilter.java:66) at com.atlassian.jira.tzdetect.IncludeResourcesFilter.doFilter(IncludeResourcesFilter.java:39) <+3>
(DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) at com.atlassian.jira.baseurl.IncludeResourcesFilter.doFilter(IncludeResourcesFilter.java:38) <+8>
(AbstractHttpFilter.java:31) (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42)
(DelegatingPluginFilter.java:66) (ContextFilter.java:25) (DelegatingPluginFilter.java:74)
(IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) at com.atlassian.mywork.client.filter.ServingRequestsFilter.doFilter(ServingRequestsFilter.java:37) <+3>
(DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) at com.atlassian.prettyurls.filter.PrettyUrlsDispatcherFilter.doFilter
(PrettyUrlsDispatcherFilter.java:60) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42)
(DelegatingPluginFilter.java:66) at com.atlassian.prettyurls.filter.PrettyUrlsSiteMeshFilter.doFilter(PrettyUrlsSiteMeshFilter.java:92)
<+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) at com.atlassian.prettyurls.filter.PrettyUrlsMatcherFilter.doFilter(PrettyUrlsMatcherFilter.java:56) <
+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) at com.atlassian.labs.botkiller.BotKillerFilter.doFilter(BotKillerFilter.java:36) <+23>
(DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77)
(ServletFilterModuleContainerFilter.java:63) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210)
(AccessLogFilter.java:103) (AccessLogFilter.java:87) (ApplicationFilterChain.java:243)
(ApplicationFilterChain.java:210) (XsrfTokenAdditionRequestFilter.java:54) (ApplicationFilterChain.java:243)
(ApplicationFilterChain.java:210) (SiteMeshFilter.java:181) (SiteMeshFilter.java:85)
(SitemeshPageFilter.java:123) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210)
(ChainedFilterStepRunner.java:87) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210)
(IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66) at com.atlassian.prettyurls.filter.PrettyUrlsCombinedMatchDispatcherFilter.doFilter
(PrettyUrlsCombinedMatchDispatcherFilter.java:61) <+22> (DelegatingPluginFilter.java:74)
(IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77)
(ServletFilterModuleContainerFilter.java:63) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210)
(SecurityFilter.java:234) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210)
(TrustedApplicationsFilter.java:100) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210)
(BaseLoginFilter.java:169) (JiraLoginFilter.java:70) (ApplicationFilterChain.java:243)
(ApplicationFilterChain.java:210) (IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66)
(OAuthFilter.java:55) (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42)
(DelegatingPluginFilter.java:66) at com.atlassian.prettyurls.filter.PrettyUrlsCombinedMatchDispatcherFilter.doFilter
(PrettyUrlsCombinedMatchDispatcherFilter.java:61) <+13> (DelegatingPluginFilter.java:74)
(IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77)
(ServletFilterModuleContainerFilter.java:63) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210)
(ProfilingFilter.java:99) (JIRAProfilingFilter.java:19) (ApplicationFilterChain.java:243)
(ApplicationFilterChain.java:210) (AbstractJohnsonFilter.java:71) (ApplicationFilterChain.java:243)
(ApplicationFilterChain.java:210) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) <+10>
(UrlRewriteFilter.java:394) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210)
(GzipFilter.java:80) (GzipFilter.java:51) (JiraGzipFilter.java:55) (ApplicationFilterChain.java:243)
(ApplicationFilterChain.java:210) (IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66) at com.atlassian.prettyurls.filter.PrettyUrlsCombinedMatchDispatcherFilter.doFilter
(PrettyUrlsCombinedMatchDispatcherFilter.java:61) <+41> (DelegatingPluginFilter.java:74)
(IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) (JWDSendRedirectFilter.java:25)
(DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77)
(ServletFilterModuleContainerFilter.java:63) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210)
(ChainedFilterStepRunner.java:87) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210)
(AbstractCachingFilter.java:33) (AbstractHttpFilter.java:31) (ApplicationFilterChain.java:243)
(ApplicationFilterChain.java:210) (AbstractEncodingFilter.java:41) (AbstractHttpFilter.java:31)
(PathMatchingEncodingFilter.java:49) (AbstractHttpFilter.java:31) (ApplicationFilterChain.java:243)
(ApplicationFilterChain.java:210) (JiraStartupChecklistFilter.java:78) (ApplicationFilterChain.java:243)
(ApplicationFilterChain.java:210) (ChainedFilterStepRunner.java:87) (JiraFirstFilter.java:57)
(ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (StandardWrapperValve.java:225)
(StandardContextValve.java:123) (AuthenticatorBase.java:581) (StandardHostValve.java:168)
(ErrorReportValve.java:98) (StandardEngineValve.java:118) (AccessLogValve.java:927) (CoyoteAdapter.java:407)
(AbstractHttp11Processor.java:1001) (AbstractProtocol.java:585) (JIoEndpoint.java:310) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
Attaching screen shots and error log. I still believe it is giving error, because I am trying to link the issue in the transition screen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you please try removing the transition screen and test if the validator works as expected without the transition screen.
Thanks
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you need that user make any link or a link of specified type, for example bloked by?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Join the largest European gathering of the Atlassian Community and reimagine what’s possible when great teams and transformative technology come together. Plus, grab your Super Fan ticket now and save over €1,000 on your pass before prices rise on 3 June.
Register nowOnline 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.