Problem creating sub-task through parent workflow with script runner

JPB February 6, 2015

I have a project in which for a certain issue type, in his workflow, I create a Script Post-Function of type 'Create a sub-task' in his create transition.

In the configuration, I set the 'Target Issue Type' and a summary for the subtask, that's all.

When I create the parent issue, and the script runs, the subtask is not created, and this is the error message shown in the log:

2015-02-06 11:58:49,171 http-bio-8080-exec-9 WARN JPulgarinB 718x11221x2 1igg7m8 172.28.110.62,127.0.0.1 /secure/QuickCreateIssue.jspa [jira.workflow.postfunctions.CloneIssue] Could not set security level, as the schemes between the two projects are different.
2015-02-06 11:58:49,207 http-bio-8080-exec-9 ERROR JPulgarinB 718x11221x2 1igg7m8 172.28.110.62,127.0.0.1 /secure/QuickCreateIssue.jspa [scriptrunner.jira.workflow.ScriptWorkflowFunction] *************************************************************************************
2015-02-06 11:58:49,210 http-bio-8080-exec-9 ERROR JPulgarinB 718x11221x2 1igg7m8 172.28.110.62,127.0.0.1 /secure/QuickCreateIssue.jspa [scriptrunner.jira.workflow.ScriptWorkflowFunction] Script function failed on issue: null, actionId: 1, file: null
java.lang.NullPointerException
        at com.atlassian.jira.issue.customfields.impl.SelectCFType.getDefaultValue(SelectCFType.java:244)
        at com.atlassian.jira.issue.customfields.impl.SelectCFType.getDefaultValue(SelectCFType.java:69)
        at com.atlassian.jira.issue.fields.CustomFieldImpl.getDefaultValue(CustomFieldImpl.java:1248)
        at com.atlassian.jira.issue.IssueImpl.getCustomFieldValue(IssueImpl.java:1007)
        at com.atlassian.jira.issue.IssueImpl.setCustomFieldValue(IssueImpl.java:1016)
        at com.atlassian.jira.issue.MutableIssue$setCustomFieldValue$2.call(Unknown Source)
        at com.onresolve.scriptrunner.canned.jira.utils.AbstractCloneIssue$_copyCustomFieldValues_closure3.doCall(AbstractCloneIssue.groovy:141)
        at com.onresolve.scriptrunner.canned.jira.utils.AbstractCloneIssue.copyCustomFieldValues(AbstractCloneIssue.groovy:133)
        at com.onresolve.scriptrunner.canned.jira.utils.AbstractCloneIssue.doScript(AbstractCloneIssue.groovy:62)
        at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CreateSubTask.super$2$doScript(CreateSubTask.groovy)
        at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CreateSubTask.doScript(CreateSubTask.groovy:120)

 

Any ideas of what is happening??

By the way, when I have a parent issue and create the subtask manually, it is created without any problem.

3 answers

1 vote
Cesare Jacopo Corzani
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.
February 9, 2015

The order may be wrong. Make sure that your post function is after the creation of the issue.

In doubt put it at the end.

Screen Shot 2015-02-09 at 13.07.36.png

JPB February 9, 2015

No, that's ok, I put it after the re-index post function, this is not the first time I create a sub-task this way, actually, I did the same in other jira environments, and is working ok, the subtask is created, but in the jira instance that I'm doing it, is showing that error in the log, and the subtask in not created.

0 votes
JPB February 9, 2015

Hi Cesare, I'm not using any code at all, just the workflow post-function.
I have a project configured with some issues and subtask, and in the workflow of a parent issue, in the create transition, I just add a post function of type 'Create a sub-task', where I choose the issue type for that subtask, and give a text for the summary, that's all.

config.jpg

JPB February 9, 2015

I tried the same in another project, with another issue type and workflow, but the problem is the same.

Cesare Jacopo Corzani
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.
February 18, 2015

Which version of Script Runner do you have?

JPB February 19, 2015

The last one, 3.0.10. But that's not the problem, as I said before, in another testing environment works ok, but in production and other testing environments, is not working, I think there's a problem with the data of those environments that makes conflict with some script runner code.

JamieA
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.
February 20, 2015

The problem seems to be related to one of the select/multiselect/radio/checkbox fields on the parent issue, that is also on the child issue. Are there any like this?

JamieA
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.
February 20, 2015

we tried to reproduce this actually... can you try in a different workflow/project or something so we can rule things out?

JamieA
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.
February 20, 2015

or you can create an issue at https://jamieechlin.atlassian.net/browse/GRV and get us a backup of your db if you're desperate.

JPB February 20, 2015

I did those tests some days ago, I just created a new project for this, just with summary assignee and description, same for the child, and the problem was the same, that's the reason I asked you :) , cause that was very strange

JPB March 6, 2015

I cannot give a backup of the db because of the information that the company works with.

0 votes
Cesare Jacopo Corzani
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.
February 8, 2015

Could you please add some details about the code you are using to create the subtask?

It seems that you have a null parent issue when you are going to create the subtask.

Suggest an answer

Log in or Sign up to answer