It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Automatic Creation of a Subtask when a bug issue is created?

Bharadwaj Jannu Jan 10, 2013

when a bug issue is created,then automatically the subtask issue should be created.

How to approach and what are the steps?

4 answers

1 accepted

0 votes
Answer accepted
Rambanam Prasad Jan 10, 2013

Create your own post function and configure on create step

check the following link to how to write post function

Bharadwaj Jannu Jan 10, 2013

How to get the parent issue in my subtask issue function?

Rambanam Prasad Jan 11, 2013
Issue currentIssue = (Issue) transientVars.get("issue");

Bharadwaj Jannu Jan 14, 2013

Thanks Prasad,

I've written the following code

protected void

createSubTask(Map<String, Object> transientVariables, Map<String, String> args)


Issue originalIssue = (Issue)transientVariables.get(


Issue parentIssue = originalIssue;

parentIssue =


MutableIssue issueObject =






//issueObject.setSummary(replaceHelper.findReplace((String)args.get("field.subIssueSummary"), parentIssue, originalIssue, transientVariables));

Map params =

new HashMap();


"issue", issueObject);



User user = ComponentManager.getInstance().getJiraAuthenticationContext().getLoggedInUser();

Issue subTask =


.createIssueObject(user, params);


.createSubTaskIssueLink(parentIssue, subTask, user);






(Exception e)


log.error("Unexpected exception"

, e);






It is creating the issue but not creating the subtask issue returning //Create Issue:null//


1 vote
Naren Jan 10, 2013

Try using the Create On Transition Plugin. You can use the post-function to create a subtask. Also go through this documentation

Hope this helps!

1 vote
Renjith Pillai Jan 10, 2013

Or use script runner, that will make life easier so that you need not write a plugin. The post function automatically defines an 'issue' object and you can use it.

Harry Chan Jan 10, 2013

I would go with Script Runner too. Groovy scripts are quite neat.

0 votes
Mizan Ali Sayed Jan 10, 2013

Create a separate workflow for bug issuetype and apply post function provided by Create on transition plugin as said by Naren on the crete transition of this workflow.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Next-gen

Introducing subtasks for breaking down work in next-gen projects

Teams break work down in order to help simplify complex tasks. This is often done iteratively, with tasks being broken down into smaller tasks and so on until the work is accurately captured in well-...

4,587 views 21 23
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you