"Create a sub-task. Will optionally reopen a matching sub-task." not working, but I do not change the summary

Steven Wilson December 4, 2014

As the title says,  

"Create a sub-task. Will optionally reopen a matching sub-task." is not working, but I do not change the summary via scripts, and the Subtask Summary field is set.

I followed this previous question

https://answers.atlassian.com/questions/314926

But as I mentioned, the Subtask Summary field is not changed, and does exist, so that answer does not help.

Groovy Script Runner version 2.1.17
Jira version 6.2.7
Jira Agile version 6.6.0

Additional issue actions

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.crowd.embedded.api.User
userManager = (UserManager)  ComponentAccessor.getUserManager()
MutableIssue issue = issue
def cf_1 = customFieldManager.getCustomFieldObjectByName('Campaign Manager')
User usera = userManager.getUser(issue.getCustomFieldValue(cf_1).getUsername());
issue.setAssignee(usera);

Subtask Action: is blank

Thanks in advance for the assistance.

3 answers

1 accepted

2 votes
Answer accepted
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.
January 8, 2015

The subtask action can't be blank - it needs to know which transition to do on it. 

I guess the script title is not the most accurate. What it means to say, is that it will optionally do some action on the child, maybe because you want to keep it in sync with the parent state, for instance reopen it.

Blank means you are choosing the option not to do any action on the subtask. 

Sorry, I missed this on first read.

Edit - I need to update a few of the descriptions... some of them are ambiguous, and this one is just plain confusing.

 

0 votes
Lacey McDonnell December 9, 2015

@Jamie Echlin [Adaptavist]

Trying to do this, reopen a sub-task from a resolved parent - all on script page is blank except the existing subtask issue type (Defect) and the Sub-Task action which is the transition I expect to fire. It keeps creating a new sub-task ... What am I missing??

 

Groovy Script Runner version 2.1.17
Jira version 6.4.11, 5.1

Sub-Task Action: Schedule and Move to Dev Team (331)

(This transition is listed on the child issue)

Part of the problem is the summary is going to change for every single issue - it won't be the same for each issue, so the example in the scriptrunner tutorial doesn't really work for us.

I also tried Reopen (31) with the same result.

https://scriptrunner.adaptavist.com/4.1.3.5/jira/builtin-scripts.html#_create_a_sub_task

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.
December 10, 2015

It will only work with a hard-coded summary. If you don't have that you will need to write your own script to reopen the subtask... which will have to include knowing which subtask to reopen, if more than one.

0 votes
Steven Wilson January 13, 2015

That was not a solution I expected.  Thank you very much for your help!

Suggest an answer

Log in or Sign up to answer