Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JIra REST Client Problem in creating a issue with custom fields

heiko ackermann
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 10, 2020

Hey

I' am using the com.atlassian.jira.rest.client.api.JiraRestClient

to create an new issue

I use this code:

 

IssueInputBuilder iib = new IssueInputBuilder();
iib.setProjectKey(projectKey);

iib.setSummary(issue.getSummary());
IssueType it = new IssueType(new URI(JIRA_URI), JIRA_ISSUE_ID, issue.getSummary(), false, issue.getDescription(), null);
iib.setIssueType(it);
iib.setFieldValue("labels", ImmutableList.of("label1", "label2"));

// iib.setFieldValue("customfield_10000",
// ComplexIssueInputFieldValue.with("value", "testAB"));

String res
= mRestClient.getIssueClient().createIssue(iib.build()).claim().getKey();

 

And it works properly until I want to use the custom Fields.

 I always get the error field is not the screen

This is xml format of the issue definition

 

<rss version="0.92">
<channel>
<title>Marquardt_Jira_System_01</title>
<link>http://jira.marquardt.de:8080</link>
<description>This file is an XML representation of an issue</description>
<language>en-us</language>
<build-info>
<version>8.7.1</version>
<build-number>807001</build-number>
<build-date>10-02-2020</build-date>
</build-info>
<item>
<title>[TCLTSTAR-19] testjiradreitk</title>
<link>http://jira.marquardt.de:8080/browse/TCLTSTAR-19</link>
<project id="10207" key="TCLTSTAR">T_CLT214_STARC</project>
<description/>
<environment/>
<key id="10706">TCLTSTAR-19</key>
<summary>testjiradreitk</summary>
<type id="10001" iconUrl="http://jira.marquardt.de:8080/images/icons/issuetypes/story.svg">Story</type>
<priority id="3" iconUrl="http://jira.marquardt.de:8080/images/icons/priorities/medium.svg">Medium</priority>
<status id="10100" iconUrl="http://jira.marquardt.de:8080/" description="">To Do</status>
<statusCategory id="2" key="new" colorName="blue-gray"/>
<resolution id="-1">Unresolved</resolution>
<assignee username="-1">Unassigned</assignee>
<reporter username="mqDefectSync">mqDefectSync</reporter>
<labels>
<label>label1</label>
<label>label2</label>
</labels>
<created>Fri, 10 Jul 2020 16:10:08 +0200</created>
<updated>Fri, 10 Jul 2020 16:10:08 +0200</updated>
<due/>
<votes>0</votes>
<watches>1</watches>
<attachments></attachments>
<subtasks>
</subtasks>
<customfields>
<customfield id="customfield_10000" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
<customfieldname>Development</customfieldname>
<customfieldvalues>
</customfieldvalues>
</customfield>
<customfield id="customfield_10105" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
<customfieldname>Rank</customfieldname>
<customfieldvalues>
<customfieldvalue>0|i003i7:</customfieldvalue>
</customfieldvalues>
</customfield>
</customfields>
</item>
</channel>
</rss>

 

 

And this is

 

My:

 

1 answer

0 votes
Italo Qualisoni [e-Core]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 10, 2020

Hi @heiko ackermann ,

Welcome to the community!

JIRA REST API will allow you to set only the fields present in the create screen;

The error field is not the screen means that the custom field you want to set during the issue creation is not present in the create screen. 

You should check with your JIRA Admin if it's possible to include the fields you want to set in the create screen, or you also could update the issue after the issue get created if the fields you are looking for are present in the edit screen.

Suggest an answer

Log in or Sign up to answer