Comments (15)
Interesting. This might be similar to another issue someone e-mailed me about. Do you happen to know what the JSON is expected to look like? I haven't come across that field type before.
from jira-client.
Does this help you at all?
"customfield_10023":[{"value":"Yes","id":"10013"}]
I got this by viewing the issue's fields in a debugger after retrieving an issue from Jira - I manually set the checkbox using the Jira web interface so that's what it should "look like" when a checkbox is checked.
Thanks for the fast response on this!
EDIT:
I don't know if this helps, but this is the format from a text field custom field.
"customfield_10011":{"value":"Customer","id":"10001"}
from jira-client.
Yes that does help. I'll take a look soon.
from jira-client.
What I have found so far:
I set up the same type of custom field in jira-client.atlassian.net. When you login check out https://jira-client.atlassian.net/rest/api/2/issue/JIR-1/editmeta.
Field in question metadata: "customfield_10027":{"required":false,"schema":{"type":"array","items":"string","custom":"com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes","customId":10027}
Schema defines array of type string and that is what we're passing. I checked.
from jira-client.
@chaplinkyle Did you attempt to set one of the checkboxes in the multicheckbox using jira-client? Thanks for taking the time to look into this!
from jira-client.
I'm not sure if the meta data I retrieved for my custom field helps in this issue or not:
customfield_10025 {"required":false,"schema": "type":"array","items":"string","custom":"com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes","customId":10025},"name":"Customer Data Loss Flag","hasDefaultValue":false,"operations":["add","set","remove"],"allowedValues":[{"self":" ...server url... /jira/rest/api/2/customFieldOption/10014","value":"Yes","id":"10014"}]}
from jira-client.
I have managed to set checkboxes, here is how:
Issue symptom = jiraClient.getIssue("EM-559");
JSONObject valueObject = new JSONObject(); // from import net.sf.json.JSONObject;
valueObject.put("value", "Yes"); // Yes it the only option for this particular checkbox field
ArrayList<Object> fields = new ArrayList<Object>();
fields.add(valueObject);
symptom.update().field("customfield_10023", fields).execute();
I'm not sure if it was designed to only work this way or if there is another way. If not then I hope what I have found helps you fix the implementation. At the least maybe now some comments can be made about how to set checkboxes with jira-client. Thanks again for the awesome tool.
from jira-client.
That helped a lot actually. The problem is the metadata returned by JIRA lies about what the type actually is. An array of strings (as the metadata indicates) should be an array of strings, but it's really expecting an array of dictionaries.
Can you build jira-client from master and try this:
Issue symptom = jiraClient.getIssue("EM-559");
symptom.update().field("customfield_10023", new ArrayList<Object>() {{ add("Yes") }}).execute();
from jira-client.
Hi
I'm having this issue for all multi-select fields. I've tried your suggestion above to no avail. Any other suggestions? I've noticed there's an open feature request for this as well. #93
from jira-client.
I just confirmed that this worked for me. I created a custom field of type "Select List (multiple choices)" called "multiSelectTest" with custom field id "10101". The available options were "one", "two", and "three".
Issue problem = jiraClient.getIssue("EM-8648");
JSONObject oneObject = new JSONObject(); // from import net.sf.json.JSONObject;
oneObject.put("value", "one");
JSONObject twoObject = new JSONObject();
twoObject.put("value", "two");
ArrayList<Object> fields = new ArrayList<Object>();
fields.add(oneObject);
fields.add(twoObject);
problem.update().field("customfield_10101", fields).execute();
The String representation of 'fields' is "[{"value":"one"}, {"value":"two"}]".
Hope this helps!
from jira-client.
Thanks for this. I actually resolved the issue by making a change to the client. I'll try and create a pull request tomorrow.
from jira-client.
I'm interested in knowing what wasn't working correctly with the client, I thought it was working correctly.
from jira-client.
Thanks for this. I actually resolved the issue by making a change to the client. I'll try and create a pull request tomorrow.
On 24 Jul 2015 12:29 am, Andrew Boutin [email protected] wrote:I just confirmed that this worked for me. I created a custom field of type "Select List (multiple choices)" called "multiSelectTest" with custom field id "10101". The available options were "one", "two", and "three".
Issue problem = jiraClient.getIssue("EM-8648");
JSONObject oneObject = new JSONObject(); // from import net.sf.json.JSONObject;
oneObject.put("value", "one");
JSONObject twoObject = new JSONObject();
twoObject.put("value", "two");
ArrayList fields = new ArrayList();
fields.add(oneObject);
fields.add(twoObject);
problem.update().field("customfield_10101", fields).execute();
The String representation of 'fields' is "[{"value":"one"}, {"value":"two"}]".
Hope this helps!
βReply to this email directly or view it on GitHub.
from jira-client.
Can you update this merged code in Maven repo? Need this API so much. Thanks. @rcarz
BTW the define JSON method is not working for me. I used code from Maven 0.5 version. Returns:
Field 'customfield_10101' does not exist or read-only
.
from jira-client.
Can somebody help with this? None of the options up there work for me, I constantly get
400 400: {"errorMessages":[],"errors":{"Detected on Env":"expected Object","Country":"expected Object"}}
I've added them as objects
JSONObject envObject = new JSONObject();
envObject.put("value", "UAT");
envObject.put("id","10911");
JSONObject countryObject = new JSONObject();
countryObject.put("value", "RO");
countryObject.put("id", "10900");
newIssue.field("customfield_11500", new ArrayList() {{add(countryObject);}})
.field("customfield_11503", new ArrayList() {{add(envObject);}})
.execute();
from jira-client.
Related Issues (20)
- how can i link Confluence Page HOT 1
- Failed to create issue 400 400: Bad Request Issue$FluentCreate.executeCreate
- Can not get Worklog started date
- Delete issue HOT 1
- Import/feature is not working with custom field
- URIBuilder Chinese garbled problem
- Attachment download fails to authenticate
- Empty Date field in the Attachment object
- Exception in thread "main" net.rcarz.jiraclient.JiraException: Failed to search issues HOT 2
- Agile API have not been supported in Version 0.5
- with version0.5 in springboot, method getPriorities error, return 404
- Any plans to publish to Maven Central repository? HOT 1
- A dozen of latest pull requests are failing CI builds
- Not able to create ticket if fields is multiselect - getting net.rcarz.jiraclient.RestException: 400 : {"errorMessages":[],"errors":{"Customer":"expected Object"}}
- Create a new maven release with more precise time stamps for comments HOT 2
- Junit and mockito in dependecies
- Any plan to create new version
- net.rcarz.jiraclient.RestClient#buildURI is adding a null part in path and it is resulting in a 404 response. HOT 1
- Failed to create issue - Field expects an Iterable value
- Creating issues broken with JIRA v9 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jira-client.