对于我检查的所有来源,此问题的答案已过时或不完整。
以下是一些例子:
Delete issue in JIRA using Java
How do I save a value into a custom field in JIRA programmatically?
JIRA creating issue using java
Automating custom field value change in JIRA
Jira: How to obtain the previous value for a custom field in a custom IssueEventListener
我没有足够的声誉来评论任何一个问题。但我有一个答案。
答案 0 :(得分:1)
所以这是我的决议:
CustomField csUserField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName(fieldName);
IssueService issueService = ComponentAccessor.getIssueService();
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters();
issueInputParameters.addCustomFieldValue(csUserField.getId(), value_string);
issueInputParameters.setSkipScreenCheck(true);
issueInputParameters.setRetainExistingValuesWhenParameterNotProvided(true, true);
UpdateValidationResult updateValidationResult = issueService.validateUpdate(user, issue.getId(), issueInputParameters);
if (updateValidationResult.isValid())
{
IssueResult updateResult = issueService.update(user, updateValidationResult);
if (!updateResult.isValid())
{
log.warn("ISSUE has NOT been updated. Errors: {}\n", updateResult.getErrorCollection().toString());
}
else
{
log.warn("ISSUE has been updated.\n");
}
}
else
{
log.warn("ISSUE has NOT been updated. Errors: {}\n", updateResult.getErrorCollection().toString());
}