Hello everyone,
I have browsed extensively on this error, and people either say that the field name is wrong or the field value is wrong in their cases but I have tried all possible combinations to no avail.
I am using Java API for JIRA to create a new bug, and my company has a field called "Detected by Test Type" (customfield_15870). The accepted values are "Integration Testing", "Functional Testing" and "Performance Testing". Each look like this (I did a getField on this field from an existing bug and got individual values)
value: "Performance Testing" id: "12345" self: "https:///rest/api/2/customFieldOption/12345" disabled: false
This tells me I got the field name correct, and the individual values correct too.
Here is my code:
Map<String, Object> cascadingValues = <span>new</span> <span>HashMap</span><String, Object>();
cascadingvalues.put(<span>"value"</span>, <span>"Performance Testing"</span>);
cascadingvalues.put(<span>"id"</span>, <span>"12345"</span>);
cascadingvalues.put(<span>"disabled"</span>, <span>false</span>);
cascadingvalues.put(<span>"self"</span>, <span>"https://<url>/rest/api/2/customFieldOption/12345"</span>);
iib.setFieldValue(<span>"customfield_15870"</span>, <span>new</span> <span>ComplexIssueInputFieldValue</span>(cascadingValues));
I have tried these options as well:
iib.setFieldValue(<span>"customfield_15870"</span>, ComplexIssueInputFieldValue.with(<span>"value"</span>, <span>"Performance Testing"</span>));
iib.setFieldValue(<span>"customfield_15870"</span>, ComplexIssueInputFieldValue.with(<span>"id"</span>, <span>"Performance Testing"</span>));
iib.setFieldValue(<span>"customfield_15870"</span>, ComplexIssueInputFieldValue.with(<span>"value"</span>, <span>"12345"</span>));
iib.setFieldValue(<span>"customfield_15870"</span>, ComplexIssueInputFieldValue.with(<span>"id"</span>, <span>"12345"</span>));
And yet, it throws me the "Option id 'null' is not valid" error. Can someone please help?
Here is the stack trace:
RestClientException{statusCode=Optional.of(<span>400</span>), errorCollections=[ErrorCollection{status=<span>400</span>, errors={customfield_15870=Option id <span>'null'</span> is not valid}, errorMessages=[]}]}
at com.atlassian.jira.rest.client.internal.async.DelegatingPromise.claim(DelegatingPromise.java:<span>47</span>)
at com.bla.jira.IssueWriterBeta.createIssue(IssueWriterBeta.java:<span>340</span>)
at com.bla.almutil.ConnectToJira.createEpic(ConnectToJira.java:<span>282</span>)
at com.bla.almutil.ConnectToJira.main(ConnectToJira.java:<span>378</span>)
Caused by: RestClientException{statusCode=Optional.of(<span>400</span>), errorCollections=[ErrorCollection{status=<span>400</span>, errors={customfield_15870=Option id <span>'null'</span> is not valid}, errorMessages=[]}]}
at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$<span>2.</span>apply(AbstractAsynchronousRestClient.java:<span>173</span>)
at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$<span>2.</span>apply(AbstractAsynchronousRestClient.java:<span>167</span>)
at com.atlassian.httpclient.api.ResponsePromiseMapFunction.apply(ResponsePromiseMapFunction.java:<span>48</span>)
at com.atlassian.httpclient.api.ResponsePromiseMapFunction.apply(ResponsePromiseMapFunction.java:<span>12</span>)
at com.atlassian.util.concurrent.Promises$Of$<span>3.</span>apply(Promises.java:<span>295</span>)
at com.atlassian.util.concurrent.Promises$<span>2.</span>onSuccess(Promises.java:<span>185</span>)
at com.google.common.util.concurrent.Futures$<span>7.</span>run(Futures.java:<span>1072</span>)
at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:<span>253</span>)
at com.google.common.util.concurrent.ExecutionList$RunnableExecutorPair.execute(ExecutionList.java:<span>161</span>)
at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:<span>146</span>)
at com.google.common.util.concurrent.AbstractFuture.done(AbstractFuture.java:<span>235</span>)
at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:<span>172</span>)
at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:<span>53</span>)
at com.atlassian.util.concurrent.Promises$Of$<span>3.</span>apply(Promises.java:<span>295</span>)
at com.atlassian.util.concurrent.Promises$<span>2.</span>onSuccess(Promises.java:<span>185</span>)
at com.google.common.util.concurrent.Futures$<span>7.</span>run(Futures.java:<span>1072</span>)
at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:<span>253</span>)
at com.google.common.util.concurrent.ExecutionList$RunnableExecutorPair.execute(ExecutionList.java:<span>161</span>)
at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:<span>146</span>)
at com.google.common.util.concurrent.AbstractFuture.done(AbstractFuture.java:<span>235</span>)
at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:<span>172</span>)
at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:<span>53</span>)
at com.atlassian.httpclient.apache.httpcomponents.SettableFuturePromiseHttpPromiseAsyncClient$<span>1</span>$<span>1.</span>run(SettableFuturePromiseHttpPromiseAsyncClient.java:<span>46</span>)
at com.atlassian.httpclient.apache.httpcomponents.SettableFuturePromiseHttpPromiseAsyncClient$ThreadLocalDelegateRunnable$<span>1.</span>run(SettableFuturePromiseHttpPromiseAsyncClient.java:<span>197</span>)
at com.atlassian.httpclient.apache.httpcomponents.SettableFuturePromiseHttpPromiseAsyncClient.runInContext(SettableFuturePromiseHttpPromiseAsyncClient.java:<span>90</span>)
at com.atlassian.httpclient.apache.httpcomponents.SettableFuturePromiseHttpPromiseAsyncClient$ThreadLocalDelegateRunnable.run(SettableFuturePromiseHttpPromiseAsyncClient.java:<span>192</span>)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)Thank you in advance!