Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Create Subtask with java plugin

Justin S October 15, 2012

With my issue event listener java plugin for jira 5, i can successfully create a new task. But how can I create a subtask?

IssueInputParameters issueSubtaskParams = issueService.newIssueInputParameters();
issueSubtaskParams.setSummary("Testing...");
...
issueSubtaskParams.setProjectId(issue.getProjectObject().getId());
issueSubtaskParams.setIssueTypeId(issueSubtaskTypeId);

CreateValidationResult validationResult = issueService.validateCreate(user, issueInputParameters);
IssueService.IssueResult issueResult = issueService.create(user, validationResult);

return issueResult.getIssue().getId();

If this creates a task, how can I create a subtask that is parented to another task?

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

5 votes
Answer accepted
Jobin Kuruvilla [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.
October 15, 2012

use validateSubtaskCreate instead of validateCreate.

Andy Brook [Plugin People]
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.
October 15, 2012

I scanned the api but missed the validate prefix!

Jobin Kuruvilla [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.
October 15, 2012

:) Haven't used it myself but seems like the one.

Jobin Kuruvilla [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.
October 16, 2012

Use SubtaskManager to create the link.

createSubTaskIssueLink

Justin S October 16, 2012

Argh how did I miss that! Thanks! Currently it is creating a subtask, but it is not parented to the original task. I use issueService.validateSubtaskCreate to create the validation with the id (not key, but id) of the main task, and then issueService.create to create it. I saw no subtask function for the latter. Is there any additional params I need to put to parent it to the main task?

Justin S October 17, 2012

Yep that was it, thank you very much!

0 votes
Andy Brook [Plugin People]
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.
October 15, 2012

Hi Justin, it seems the IssueInputParams doesn't let you set a parentId through the api, I wonder if you can set the parentId in the value map (issueSubtaskParams.getFieldValueHolder())?

TAGS
AUG Leaders

Atlassian Community Events