Trying to set up either a workflow post function or a groovy listener to create sub tasks automatically using the canned script with the script runner plugin. Either way I've set it up, I'm currently running into an error that says I cannot create a subtask on a ticket with a resolution. I'm at a bit of a loss at the moment since I've even tried this on a newly created issue and getting the same error. I would assume the NPE right before the error message is related. I'm using JIRA 6.0.5 and Script Runner 2.1.15.
2014-07-09 07:47:57,644 ajp-bio-10.105.9.114-8014-exec-7 ERROR 467x1924x1 yc0ktv 216.128.252.71 /secure/WorkflowUIDispatcher.jspa [groovy.canned.utils.ConditionUtils] javax.script.ScriptException: java.lang.NullPointerException 2014-07-09 07:47:57,645 ajp-bio-10.105.9.114-8014-exec-7 ERROR 467x1924x1 yc0ktv 216.128.252.71 /secure/WorkflowUIDispatcher.jspa [onresolve.jira.groovy.GroovyFunctionPlugin] Error executing post-function com.atlassian.jira.exception.CreateException: Error occurred while creating issue through workflow: Cannot create a sub task on a ticket with a resolution. at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:498) at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:428) at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssueObject(DefaultIssueManager.java:513) at com.atlassian.jira.issue.IssueManager$createIssueObject.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42) at com.atlassian.jira.issue.IssueManager$createIssueObject.call(Unknown Source) Caused by: [InvalidInputException: [Error map: [{}]] [Error list: [[Cannot create a sub task on a ticket with a resolution.]]]
Hmm, that does try to tell you what is wrong. I understand the logic behind it (if something is resolved, why on earth are you creating sub-tasks for it? It's done, you shouldn't be opening up more work on it!), but I'm not 100% sure if it's the script runner or your workflow. Either way, you need to reconsider why you're creating subtasks under resolved issues.
Error occurred while creating issue through workflow: Cannot create a sub task on a ticket with a resolution.
The thing is, I'm not trying to create a subtask on a resolved issue. I have tried this from a newly created issue. I've gone so far as to check the database to do a select from the jiraissue table to ensure that the resolution was not set there. I'm at a total loss for why this error message is appearing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Restarted JIRA and got a different NPE before the big stack trace. The larger stack trace appears to be the same. I'm making guesses now, but maybe some sort of issue object is null and it's failing to get the resolution object on it. In turn, it's throwing the stack trace saying it can't create a subtask on a ticket with a resolution because something is in the conditional where it's checking that.
2014-07-09 09:14:07,113 ajp-bio-10.105.9.114-8014-exec-9 ERROR 554x438x2 10ctzre 216.128.252.71 /secure/WorkflowUIDispatcher.jspa [groovy.canned.utils.ConditionUtils] javax.script.ScriptException: java.lang.NullPointerException: Cannot get property 'resolutionObject' on null object
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, that is weird. You definitely don't have a resolution on the parent issue then. Wild guess - you're not setting one on the sub-task either?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is a correct guess. I was hoping to start out with something basic and work my way up to what I want. Currently, the only thing I am setting through the script would be the subtask summary and the subtask type. There are no conditions on the function and there are no additional fields set.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is a condition either on the function that creates the subtask, or in the workflow for the subtask (mostly likely on the create action). And that condition code is failing, it must be wrong.
Can you look for the condition?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Possibly you have a condition somewhere that is trying to check the resolution, but you're inadvertently using assignment rather than ==.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Looks like a simple scripted validator...? I removed the redundant frames from your stack trace to make it clearer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There was a post function on the subtask create action that was trying to clear the resolution. I removed that and everything worked like I would expect.
Not sure why I ever put a post function there to do such a thing (why would the resolution be set when creating a ticket?). Guess it was just a matter of knowing where to look.
Thanks both Nic and Jamie for your help.
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.