I have redone the same code as given in the Fast Track Transition script. The only difference being i have written the same code for getAllWorkflowActions() in my existing groovy file. I have posted th entire code here
package com.onresolve.jira.groovy.canned.workflow.postfunctions import org.apache.log4j.Category; import java.util.List; import java.util.Map; import com.atlassian.crowd.embedded.api.User import com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.util.ErrorCollection; import com.atlassian.jira.workflow.JiraWorkflow import com.atlassian.jira.workflow.WorkflowManager import com.onresolve.jira.groovy.canned.CannedScript; import com.opensymphony.workflow.loader.ActionDescriptor class TemporaryFl implements CannedScript { Category log = Category.getInstance(TemporaryFl.class) public final static String FIELD_TARGET_ISSUE_ACTION = "FIELD_TARGET_ISSUE_ACTION" public static final String FIELD_ADDITIONAL_SCRIPT = "FIELD_ADDITIONAL_SCRIPT" @Override public Map doScript(Map params) { def String actionId = params[FIELD_TARGET_ISSUE_ACTION] actionId = actionId?.replaceAll(/ .*/, "") MutableIssue issue = params['issue'] as MutableIssue log.info("params" + params) Boolean doIt = ConditionUtils.processCondition(params[ConditionUtils.FIELD_CONDITION] as String, issue, false, params) log.info("field condition" + params[ConditionUtils.FIELD_CONDITION]) log.info("doIt" + doIt) Thread executorThread = new Thread(new Runnable() { void run() { Thread.sleep(100) doTransition(issue, params, actionId) } }) if (doIt) { // possibly only need to do this on buggy versions of jira executorThread.start() // doTransition(issue, params, actionId) } else { log.info "Condition wasn't true" } [:] } private doTransition(MutableIssue issue, Map params, String actionId) { User user = WorkflowUtils.getUser(params) ComponentAccessor.getJiraAuthenticationContext().setLoggedInUser(user) WorkflowUtils.actionIssue(params[FIELD_ADDITIONAL_SCRIPT] as String, issue, actionId as Integer, user, params) } @Override public ErrorCollection doValidate(Map<String, String> arg0, boolean arg1) { // TODO Auto-generated method stub return null; } @Override public List getCategories() { ["Function"] } @Override public String getDescription() { // TODO Auto-generated method stub return "Testing" ; } @Override public String getDescription(Map<String, String> arg0, boolean arg1) { // TODO Auto-generated method stub return "Testing .." } @Override public String getName() { // TODO Auto-generated method stub return "Testing ..." } @Override public List getParameters(Map params) { [ ConditionUtils.getConditionParameter(), [ Name:FIELD_TARGET_ISSUE_ACTION, Label:"Action", Type: "list", Values: getAllWorkflowActions(), Description: """ID of the workflow action that will be applied to this issue.""" ], [ Name:FIELD_ADDITIONAL_SCRIPT, Label:"Additional code", Type:"text", Description: """Additional script to run before the issue is stored. Use this to modify fields or add a comment etc.""", Examples: [ "Set comment (4.1 and above)": "issueInputParameters.setComment(\\'Some comment\\')", "Set assignee (4.1 and above)" : "issueInputParameters.setAssigneeId(\\'someuser\\')", "Set comment (4.0 and below)": "workflowTransitionUtil.setParams([\\'comment\\': \\'Some comment\\'])", "Set assignee (4.0 and below)" : "issue.setAssigneeId(\\'someuser\\')", ], ], ] } public static Map getAllWorkflowActions() { Map<String,String> rt = new LinkedHashMap<String,String>() Map actions = new HashMap() WorkflowManager workflowManager = ComponentAccessor.getWorkflowManager() workflowManager.getWorkflows().each {JiraWorkflow workflow -> workflow.getAllActions().each {ActionDescriptor ad -> String v = "${ad.name} ($ad.id)" if (! rt.values().contains(v)) { rt.put("$ad.id ${ad.name}", v) } } } rt.putAll(actions) rt.sort {it.value} } @Override public Boolean isFinalParamsPage(Map<String, String> arg0) { // TODO Auto-generated method stub return null; } }
when i run this script i get this error in the log file. Can anyone please me out to figure what is going wrong.
groovy.lang.MissingMethodException: No signature of method: static com.onresolve.jira.groovy.canned.workflow.postfunctions.ConditionUtils.setupBinding() is applicable for argument types: (com.atlassian.jira.issue.IssueImpl, java.util.HashMap) values: [JIRA-225, [args:[class.name:com.onresolve.jira.groovy.GroovyFunctionPlugin, ...], ...]] Possible solutions: setupBinding(com.atlassian.jira.issue.MutableIssue, com.atlassian.crowd.embedded.api.User), setupBinding(com.atlassian.jira.issue.MutableIssue, java.util.Map, com.atlassian.crowd.embedded.api.User) at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1342) at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1328) at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.callStatic(StaticMetaClassSite.java:62) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:169) at com.onresolve.jira.groovy.canned.workflow.postfunctions.ConditionUtils.processCondition(ConditionUtils.groovy:77) <+3> (NativeMethodAccessorImpl.java:39) (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.invoke(StaticMetaMethodSite.java:43) at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:88) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128) at com.onresolve.jira.groovy.canned.workflow.postfunctions.TemporaryFl.doScript(TemporaryFl.groovy:36) 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.GroovyFunctionPlugin.execute(GroovyFunctionPlugin.java:35) at com.opensymphony.workflow.AbstractWorkflow.executeFunction(AbstractWorkflow.java:1050) at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1446) at com.opensymphony.workflow.AbstractWorkflow.doAction(AbstractWorkflow.java:564) at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowActionInsideTxn(OSWorkflowManager.java:916) at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowAction(OSWorkflowManager.java:871) at com.atlassian.jira.bc.issue.DefaultIssueService.transition(DefaultIssueService.java:449) at com.atlassian.jira.web.action.workflow.SimpleWorkflowAction.doExecute(SimpleWorkflowAction.java:30) <+1> (ActionSupport.java:165) at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:82) <+7> (DefaultInterceptorChain.java:39) (NestedInterceptorChain.java:31) (ChainedInterceptor.java:16) (DefaultInterceptorChain.java:35) (GenericDispatcher.java:221) (GenericDispatcher.java:185) (JiraWebworkActionDispatcher.java:153) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) <+14> (ApplicationFilterChain.java:305) (ApplicationFilterChain.java:210) (ChainedFilterStepRunner.java:78) (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.labs.botkiller.BotKillerFilter.doFilter(BotKillerFilter.java:36) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (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:40) <+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) <+20> (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:129) (SiteMeshFilter.java:77) (SitemeshPageFilter.java:124) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66) at com.atlassian.labs.remoteapps.modules.permissions.ApiScopingFilter.doFilter(ApiScopingFilter.java:60) <+41> (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:98) (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) (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) (UrlRewriteFilter.java:738) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (GzipFilter.java:74) (GzipFilter.java:51) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66) at com.atlassian.labs.remoteapps.modules.oauth.OAuth2LOFilter.doFilter(OAuth2LOFilter.java:70) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) at com.atlassian.labs.remoteapps.util.http.bigpipe.RequestIdSettingFilter.doFilter(RequestIdSettingFilter.java:22) <+43> (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:78) (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:74) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (MultiTenantServletFilter.java:91) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (ChainedFilterStepRunner.java:78) (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:312) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:662)
Are you sure you have extracted the correct version of the source?
You would be better off subclassing my class, rather than copying and pasting and setting yourself up for a merge when you upgrade.
The other thing you should have done is just made the single change of changing the class name and checking that worked. Start with a "known good" that you can always revert to.
Thanks Jamie. I did the way you explained and i could resolve the issue. Just one more thing to add. The additional script part doesnt work even if we set. I have attached the screenshot for the configuration. But when i do the tranistion and check in the comment section of the issue i cant see any additional comment being logged there. This is 2.0 version of groovyrunner.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can anyone please tel me if i am doing anything wrong in setting the additional code? After adding the additional code for eg. comments. I cant see it being added
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check your logs. I don't know what version of jira you have. Does that same additional code work with the unmodified version of fast-track?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
no Jamie its not working.i am using the existing fast track transition script. Also no logs are being recorded.
The problem is that its working in our production system. But in my standalone jira application this doednot work.
I have the same JIRA and script versions at both the ends. JIRA - 5.2.5 & Scriptrunner - 2.1.15
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Helps if you tell us what the errors are. Without that, you're asking us to debug code from scratch, and that's just a pain in the neck because we're repeating all the debugging you should have done already.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i am getting missing method exception: no signature of the method for ConditionUtils.setupBinding().
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i have already listed out the error as given in the log file. The reason i have posted the code is to highlight the changes i have done to the file
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your error messages were not posted as part of your original question, which is why I asked.
The error is pointing to you trying to pass in an object/parameter that isn't acceptable to the function you're calling. It's hard to tell which because there's not enough log to know where you're doing it, but I'd tentatively say it's in the doTransition call.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok i didnt know that the error message wasnt available. By looking at the log i did get to know that its ConditionUtils.setupBinding(). of the CannedScriptUtils.groovy file. But even though writing the same code as available in the scriptrunner jar , i dont know why is it saying the parameters passed to it isnt matching.
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.