Parent ABC-546
1st Subtask key ABC-546-01
2nd Subtask key ABC-546-02
3rd Subtask key ABC-546-03
etc.
Hi @Mary Kelly
Yes this can be possible through REST API
Example:
<span>IssueInputBuilder</span> <span>issueBuilder</span> <span>=</span> <span>new</span> <span>IssueInputBuilder</span>(<span>"Project1"</span>, <span>5L</span>);<span>//5 is the id for subtask type. You can know the id of subtask type by querying this REST api /rest/api/2/issue/createmeta</span> issueBuilder.setDescription(<span>">> Test Description"</span>); issueBuilder.setSummary(<span>"Test summary"</span>); issueBuilder.setProjectKey(<span>"Project1"</span>); Map<String, Object> parent = <span>new</span> <span>HashMap</span><String, Object>(); parent.put(<span>"key"</span>, <span>"SOMEISSUE-234"</span>); <span>FieldInput</span> <span>parentField</span> <span>=</span> <span>new</span> <span>FieldInput</span>(<span>"parent"</span>, <span>new</span> <span>ComplexIssueInputFieldValue</span>(parent)); Map<String, Object> customField = <span>new</span> <span>HashMap</span><String, Object>(); customField.put(<span>"value"</span>, <span>"someValue"</span>);<span>//This is some custom field value on the subtask</span> customField.put(<span>"id"</span>, <span>"12345"</span>);<span>//This is the id of the custom field. You can know this by calling REST GET for a manually created sub-task</span> issueBuilder.setFieldInput(parentField); issueBuilder.setFieldValue(<span>"customfield_12345"</span>, <span>new</span> <span>ComplexIssueInputFieldValue</span>(customField));<span>//here again you have to query an existing subtask to know the "customfield_*" value</span> com.atlassian.jira.rest.client.domain.input.<span>IssueInput</span> <span>issueInput</span> <span>=</span> issueBuilder.build(); <span>BasicIssue</span> <span>bIssue</span> <span>=</span> restClient.getIssueClient().createIssue(issueInput, pm); System.out.println(<span>">>> "</span> + bIssue.getKey());
to get it to associate with the parent story. the setFieldInput to parent seemed to do it
Hope this helps
Work item keys are automatically assigned by Jira in the format "ProjectKey-NNNN" where NNNN is an incrementing number for each project.
There is no way to set up the work item key in the format you've asked about ie. "ParentKey-NN"
The simplest way to be able to view subtask keys would be to put "ParentKey-NN" at the start of the Summary for the subtask.
This can be achieved by automation if you were to have a consistent set of subtasks for the parent story that would all have recurring summaries, e.g.
But if this is not the case then manually adding this when you create the subtask will be the easiest solution.
@Stephen_Lugton is right; there is no control over the issue key (at least on the cloud), and they get auto-generated.
The best option is to have the desired (incremental) key in the Summary of the newly created issue.
We at appbox allow you to create child issues using your own AI Prompts. This can simplify this task, and you can command the AI to create child issues in the desired format; please see the example demo below.
Demo - https://youtu.be/qtntxU7fiwY
Marketplace App - https://marketplace.atlassian.com/apps/1236275/ai-agents-for-jira-enterprise?hosting=cloud&tab=overview
Let us know if you have any questions.
Team,
Appbox AI
It looks like you're new here. Sign in or register to get started.