Heads up! On March 5, starting at 4:30 PM Central Time, our community will be undergoing scheduled maintenance for a few hours. During this time, you will find the site temporarily inaccessible. Thanks for your patience. Read more.
×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
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.
Hi @Mary Kelly
Yes this can be possible through REST API
Example:
IssueInputBuilder issueBuilder = new IssueInputBuilder("Project1", 5L);//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
issueBuilder.setDescription(">> Test Description");
issueBuilder.setSummary("Test summary");
issueBuilder.setProjectKey("Project1");
Map<String, Object> parent = new HashMap<String, Object>();
parent.put("key", "SOMEISSUE-234");
FieldInput parentField = new FieldInput("parent", new ComplexIssueInputFieldValue(parent));
Map<String, Object> customField = new HashMap<String, Object>();
customField.put("value", "someValue");//This is some custom field value on the subtask
customField.put("id", "12345");//This is the id of the custom field. You can know this by calling REST GET for a manually created sub-task
issueBuilder.setFieldInput(parentField);
issueBuilder.setFieldValue("customfield_12345", new ComplexIssueInputFieldValue(customField));//here again you have to query an existing subtask to know the "customfield_*" value
com.atlassian.jira.rest.client.domain.input.IssueInput issueInput = issueBuilder.build();
BasicIssue bIssue = restClient.getIssueClient().createIssue(issueInput, pm);
System.out.println(">>> " + bIssue.getKey());
to get it to associate with the parent story. the setFieldInput to parent seemed to do it
Hope this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.