我试图设置海关字段,同时我使用Java Jira Rest Client创建Jira实例。如何使用Java Jira Rest客户端在Jira中设置自定义字段(多选)
下面,就是我试图完成,其中“数据对象”是一个多选选项项的自定义字段的XML表示:
<customfield id="customfield_10730" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
<customfieldname>Environnements</customfieldname>
<customfieldvalues>
<customfieldvalue key="13044">
<![CDATA[ DATAOBJECT]]>
</customfieldvalue>
</customfieldvalues>
</customfield>
下面,是我的Java代码,让我在Jira中创建实例但没有自定义字段。
JiraRestClientFactory restClientFactory = new AsynchronousJiraRestClientFactory();
try {
JiraRestClient restClient = restClientFactory.createWithBasicHttpAuthentication(new URI("http://JIRA_DOMAIN"), "Username", "Passwd");
IssueRestClient i = restClient.getIssueClient();
IssueInputBuilder issueBuilder = new IssueInputBuilder("projectKey", issueTypeID));
issueBuilder.setSummary("description");
issueBuilder.setFieldValue("customfield_10730", "DATAOBJECT");
IssueInput issue = issueBuilder.build();
Promise<BasicIssue> promise = i.createIssue(issue);
try
{
BasicIssue basicIssue = promise.get();
System.out.println(basicIssue.getId());
restClient.close();
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}
catch (URISyntaxException e)
{
System.out.println(e.getMessage());
}
此代码不起作用,我正在使用Java Jira Rest Client 2.0.0-m31。 有人可以告诉我这里有什么问题吗?
在此先感谢。