How can I create an issue with a cascading selection custom field (option-with-child) with JRJC? Edited

I defined a cascading selection custom field in my JIRA instance, contained almost in all JIRA screens: It appears in particular in the creation and edit masks.

The first selection for cascading selection allows the options "TV", "Radio" and "Internet".

Child-options for TV are "ARD", "ZDF", "NDR", for Radio are "EinsLive", "BigFM", "WDR2", for Internet are "YouTube", "NetFlix" and "AmazonPrime".

I want to create an issue containing the "value" Radio - WDR2 for the corresponding field. (Via JIRA REST JAVA CLIENT is mandatory.)

In order to do so, I tried to imitate the JSON response comming from JIRA, via https://myserver/browse/issue-key.

JSON snipet for that field:

"customfield_11207":{"value":"Radio","child":{"value":"WDR2"}}

Here is my Code:

IssueInputBuilder builder = new IssueInputBuilder(PROJECT_KEY, BUG_TYPE_ID, "Experimental");
// ... set some mandatory fields  ...
ComplexIssueInputFieldValue headOpt = ComplexIssueInputFieldValue.with("value", "Radio");
ComplexIssueInputFieldValue childOpt = ComplexIssueInputFieldValue.with("child", ComplexIssueInputFieldValue.with("value", "WDR2"));
List<Object> fieldList = new ArrayList<Object>();
fieldList.add(0, headOpt);
fieldList.add(1, childOpt);
builder.setFieldValue("customfield_11207", fieldList);
// ...
IssueInput input = builder.build();
// ... getIssueRestClient.
// ... get a Promise<BasicIssue> via client.createIssue(input)
// ... get the BasicIssue via promise.claim();
//
 

Exception text:
RestClientException{statusCode=Optional.of(400), errorCollections=[ErrorCollection{status=400, errors={customfield_11207=Can not deserialize instance of com.atlassian.jira.issue.fields.rest.json.beans.CustomFieldOptionJsonBean out of START_ARRAY token
 at [Source: N/A; line: -1, column: -1]}, errorMessages=[]}]}

Please help.

F1!

Thank you very much!

 

0 answers

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Marketplace Apps

Three tips for boosting your board's efficiency with Story Maps

Trello is one of the most effective tools for driving your sprints. It's customizable for every Agile team and product owners and Scrum masters (SM) love it. However, Agile teams often struggle with:...

849 views 2 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you