The function that calls the jira api I'm using to set a new value of the custom fielad gives me an error and I don't understand what I'm doing wrong.
the code is pretty similirato to this one :
String ticketKey = "PROJEC-131771";
String newValue = "NEW_TEXT_VALUE";
Issue issue = restClient.getIssueClient().getIssue(ticketKey).claim();
IssueField customField =issue.getFieldByName("FIELD_NAME");
if (customField != null) {
FieldInput fieldInput = new FieldInput(customField.getId(), newValue);
IssueInputBuilder issueInputBuilder = new IssueInputBuilder();
issueInputBuilder.setFieldInput(fieldInput);
restClient.getIssueClient().updateIssue(issue.getKey(), issueInputBuilder.build()).claim();
} else {
System.out.println("Field not found");
}
the api called by the method updateIssue its returning this exception:
RestClientException{statusCode=Optional.of(400), errorCollections=[ErrorCollection{status=400, errors={customfield_11112= Could not find valid 'id' or 'value' in the Parent Option object.}, errorMessages=[]}]}
The CustomField is structed like this in JSON after the get:
IssueField{id=customfield_11112, name=FIELD_NAME type=null, value={"self":"https:\/\/JIRASERVERNAME.com\/rest\/api\/2\/customFieldOption\/11175","value":"NEW_TEXT_VALUE","id":"11175","disabled":false}}
two notes:
1)im trying to set the field with the same value that its already setted to be sure not being an error caused by the new value than i created.
2)I've already tried to pass a parameter of type JSONObject to the function, cause value seems to be a json value too, but the method gives me an error saying that it doesn't know how to handle this type, so I expect it to want a string