Forums

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

How to set the parent of a issue using groovy script in post function

SWAPNIL SRIVASTAV
Contributor
March 27, 2020

I am creating an issue automatically using script post function in  a transition. How to I set the parent issue for it. Like we have issue.getParentObject() to get the parent id, is there any method to set the parent id?

1 answer

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
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, 2020

You have not told us exactly how you are creating the sub-task, or why, but assuming you are creating a subtask on the issue that the post-function is running against, the minimal calls you need are

newSubTask.setSummary("A summary")    
newSubTask.setParentObject(issue)    
newSubTask.setProjectObject(issue.getProjectObject())    
newSubTask.setIssueTypeId(subTaskTypeId)

You'll need to provide the  subTaskTypeId in there, I can't guess what type you might need.

Suggest an answer

Log in or Sign up to answer