convert subtask to issue and change fields as well as ststus

We need to convert a sub task to a parent issue. I would like to have the ability to change the status and a set of fields.

I see the wizard has a place for workflow status and for changing fields. When the wizard runs the status portion of the wizard is not editable. 

Also, the field I need to change is not available.

How can I make the wizard render the status change and the fields I need edited.

2 answers

0 votes

The status change only happens if the workflow for the target issue type does not include the current status of the issue.  Similarly for the fields - it will only offer you the fields you actually need to change during the issue type change.

If you want to update other stuff, you have to do it as an edit, before or after the issue type move.

Another option would be to add a "Convert to Issue" workflow step (going back to the same state) and include a screen with the appropriate fields.  The workflow step will require a scriptrunner post function that does the actual conversion/unlink.  I recently wrote such a script:

import com.atlassian.jira.issue.issuetype.IssueType;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.util.IssueUpdateBean;

IssueLinkManager issueLinkManager = ComponentAccessor.getIssueLinkManager();
MutableIssue mutIssue = (MutableIssue)issue;
IssueType issueType = issue.getIssueTypeObject();
String newIssueTypeId = "3"; // Task

if (issueType.isSubTask()) {
    if(issueType.getName()=="Sub-Defect") {
        newIssueType=1; // Bug
    Issue parentIssue = issue.getParentObject();
    IssueLink subTaskLink = issueLinkManager.getIssueLink(parentIssue.getId(),issue.getId(),10000);

This is certainly not the prettiest solution, as you potentially have to add this workflow step for every state.  You would also probably want to add a condition that prevents others from seeing the transition.  This won't work at all if you have a need to select the new issue type manually (as is done using the wizard) though you could probably hack that via a custom field that you set during the edit, and then reference/clear during the script.

I wrote this for the purpose of doing bulk "Convert to Issue" as that feature isn't available until JIRA7; however, the bulk convert didn't work, the wizard threw an error when the self-referencing state transition was selected.

At a guess, convert+edit is the more reasonable approach here.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,515 views 15 20
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you