I'm trying to use JRJC to create an issue, and I must set a custom field before that is successful. I tried searching for examples, but did not find any.
Here's the code I am using to create the issue:
Long testIssueTypeId = getTestIssueTypeId(projectKey);
IssueInputBuilder builder = new IssueInputBuilder()
.setProjectKey(projectKey)
.setIssueTypeId(testIssueTypeId)
.setSummary(summary)
.setDescription(description);
IssueInput input = builder.build();
return jira.getIssueClient().createIssue(input).claim();
To the list of attributes, I need to set a custom field called "Application". In the JSON of a similar issue it appears like this:
{
"self": "https://jira.web.labs.att.com/rest/api/2/customFieldOption/14314",
"value":"NA:12345",
"id": "14314",
"disabled": false
}
What code do I need to add to the IssueInputBuilder to set this field's value? Or is there another, more preferred approach?
Thanks!
EDIT:
Here's what I've tried (for another custom field):
IssueInputBuilder builder = new IssueInputBuilder()
.setProjectKey(projectKey)
.setIssueTypeId(testIssueTypeId)
.setSummary(summary)
.setDescription(description)
.setFieldValue("Test Type",
new CustomFieldOption(14314L, null, "Functional", null, null));
With this code, I get the following error:
RestClientException{statusCode=Optional.of(400), errorCollections=[ErrorCollection{status=400, errors={Test Type=Field 'Test Type' cannot be set. It is not on the appropriate screen, or unknown.}, errorMessages=[]}]}
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.