I'm having trouble create issues of type Epic via JRJC. I have managed to add stories and sub-tasks but when I try the same sort of code as the Story for an Epic issue type I get an exception message indicating the field "Epic Name" is required:
Exception in thread "main" com.atlassian.jira.rest.client.RestClientException: Epic Name is required. at com.atlassian.jira.rest.client.internal.jersey.AbstractJerseyRestClient.invoke(AbstractJerseyRestClient.java:68) at com.atlassian.jira.rest.client.internal.jersey.AbstractJerseyRestClient.impl(AbstractJerseyRestClient.java:164) at com.atlassian.jira.rest.client.internal.jersey.AbstractJerseyRestClient.postAndParse(AbstractJerseyRestClient.java:152) at com.atlassian.jira.rest.client.internal.jersey.JerseyIssueRestClient.createIssue(JerseyIssueRestClient.java:398)
Looking at JIRA it seems this is a custom field (customfield_12601) but it is not obvious how I should set this using the issueBuilder.
Here is an example of what comes back in this field when I make a GET request using REST:
Field{id=customfield_12601, name=Epic Name, type=null, value=Test epic issue}
As per a comment by Alexsander Merzwicki on another thread I tried to using the following but it did not work for me.
IssueInputBuilder.setFieldValue("customfield_12601", "Epic name")
I also attempted the following with no success either:
FieldInput fInput = new FieldInput("customfield_12601", ComplexIssueInputFieldValue.with("value", "Epic name")); issueBuilder.setFieldInput(fInput);
Has anyone else managed to do this? Is there any documentation you can direct me to for this? Thanks.
Community moderators have prevented the ability to post new answers.
Sorted!
There was a small typo in my original implementation of Alexsander's suggestion - this is the actual syntax which works:
IssueInputBuilder issueBuilder = new IssueInputBuilder("ProjID", 10L); issueBuilder.setFieldValue("customfield_12601", "Epic Name");
Thanks Alexsander.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.