I have a requirement to provide parent ID when the jira issue is created programatically.
When I set the parent ID, my issue (sub task/sub bug) has to be created under the given parent ID issue.
Any idea, how can I do this.
I jsut set the issue id long value to my newly creatin issue. But nothing happens.
you need to use the subtaskmanager https://docs.atlassian.com/jira/server/com/atlassian/jira/config/SubTaskManager.html
there are a lot of post in the community with code sample, for example:
If you need more help I think I have a working snippet somewhere
Thanks for the quick reply. I tried subTaskManager.createSubTaskIssueLink(Issue parent, Issue subTask, User user) API. It says NoSuchMethod.
And, For Nic, I jsut tried. It creates the sub task issue seperately. But it doesn't create the subtask under the parent issue.
I do reindex after issue creation too.
Am I doing something wrong..
This code worked for me:
private void convertToSubtask(MutableIssue issue, Issue parentIssue)
SubTaskManager subTaskManager = ComponentAccessor.getSubTaskManager()
issue.setIssueTypeObject( subTaskManager.getSubTaskIssueType( this.defaultSubtaskId ) )
subTaskManager.createSubTaskIssueLink(parentIssue, issue, this.runAs)
Keep in mind what Nick said about the timing...
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...
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!
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