You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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=[]}]}