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 get a value from a specific field that determines at runtime. I was trying to check for fields by calling issue.getFields(), but it still returns null. The only one kind of method that returns value properly - method with specified in advance field (example:
issue.getSummary();)
Main method
JiraRestClient restClient = getJiraRestClient(); \\custom method for connecting in jira local server
SearchRestClient searchClient = restClient.getSearchClient();
SearchResult searchResult = searchClient.searchJql(jql, -1, 0, fields).claim();
JsonArrayBuilder issueArrayBuilder = Json.createArrayBuilder();
for (Issue issue : searchResult.getIssues()) {
Issue initIssue = restClient.getIssueClient().getIssue(issue.getKey()).claim();
JsonObjectBuilder jsonIssueBuilder = Json.createObjectBuilder();
for (String field : fields) {
JsonValue jsonValue = getJsonValueForField(initIssue, field);
jsonIssueBuilder.add(field, jsonValue);
}
JsonObject jsonIssue = jsonIssueBuilder.build();
issueArrayBuilder.add(jsonIssue);
}
return issueArrayBuilder.build();
private static JsonValue getJsonValueForField(Issue issue, String field) {
IssueField issueField = issue.getField(field);