Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create sub-tasks using groovy and post function

Adam Horba March 29, 2019

I am struggling with function which allow creating sub-task automatically after creation main task. I don't know why but all of those lines return null:

def issue = issue as MutableIssue

MutableIssue parent = issue.getParentObject() as MutableIssue

def parentIssue = issue.parentObject

def newSubTask = issueFactory.getIssue()

Issue issue = issue

I don't know how to get current issue and create subtask. This is my first experience with groovy and maybe somebody kindly help me with it. Thanks.

1 answer

0 votes
Kumar
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.
March 29, 2019

Hi @Adam Horba  You can create a subtask automatically When you change the Issue 

from Status to Another Status.

Steps: 

1) Go to the Project WorkFlow Edit it.

2) Select the Particular Transition and Click on Post Function.

3) It will List the Postfunction list 

4) Select the Scripted Postfunction and Add it and it will takes to you next window in that you have some options. 

5) Select the Create Sub-task Option

    subtask.PNG

   a) Select the Sub-task issu type that you want to create automatically

    b) if you want to copy the Field Values from Parent Issue

   c) Update it 

 

6) And Publish the Work Flow 

 

Now When that Transition is Executed it will Create automatically a subtask  

 

Please 1st test it in your Dev Environment and make changes in your Prod

 

I hope it helps

 

Thanks,

Kumar

Adam Horba March 29, 2019

Thank you @Kumar for answer but my issue is more complicated. I have to create about 20 sub-tasks depend on value from custom field. Each value from custom field has different set of sub-tasks. Generally this script is easy but I have no idea how to create single one. The rest of script i will manage on my own.

Suggest an answer

Log in or Sign up to answer