jira-client
jira-client copied to clipboard
Not able to create ticket if fields is multiselect - getting net.rcarz.jiraclient.RestException: 400 : {"errorMessages":[],"errors":{"Customer":"expected Object"}}
trafficstars
Custom Field in Jira : customfield_1003={"required":true,"schema":{"type":"array","items":"option","custom":"com.atlassian.jira.plugin.system.customfieldtypes:multiselect","customId":1003},"name":"Customer","fieldId":"customfield_1003","hasDefaultValue":false,"operations":["add","set","remove"],"allowedValues":[{"self":""}]}
Options tried: 1.
FluentCreate newIssueFluentCreate = jira.createIssue(project, issueType);
newIssueFluentCreate.field(Field.SUMMARY, summary);
newIssueFluentCreate.field("customfield_1003", new ArrayList<Object>() {{add(customer);}});
newIssueFluentCreate.field(Field.DESCRIPTION, description);
newIssueFluentCreate.field(Field.LABELS, new ArrayList<Object>() {{add(label);}});
newIssueFluentCreate.field(Field.PRIORITY, "Minor");
newIssue = newIssueFluentCreate.execute();
JSONObject customerObject = new JSONObject();
customerObject.put("value", "1225");
ArrayList<Object> customers = new ArrayList<>();
customers.add(customerObject);
FluentCreate newIssueFluentCreate = jira.createIssue(project, issueType);
newIssueFluentCreate.field(Field.SUMMARY, summary);
newIssueFluentCreate.field("customfield_1003", customers);
newIssueFluentCreate.field(Field.DESCRIPTION, description);
newIssueFluentCreate.field(Field.LABELS, new ArrayList<Object>() {{add(label);}});
newIssueFluentCreate.field(Field.PRIORITY, "Minor");
newIssue = newIssueFluentCreate.execute();
Please check out the complete description in stack overflow : https://stackoverflow.com/q/68222538/3863306