2017-01-17 6 views
-1

この質問に対する回答は、チェックしたすべてのソースで時代遅れまたは不完全です。ここでjavaを使用してjira 7+のカスタムフィールドを更新する方法

は、いくつかの例は以下のとおりです。

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

CustomFieldManager is not getting the custom field after modifying the custom field name using REST api in jira

私はこれらの質問にコメントするほどの評判はありません。しかし、私は答えがあります。だからここ

+1

が、これは質問や答えますか? –

+2

私は質問ではないので、この質問をトピックとして閉じようとしています。 – khelwood

+0

6つの質問に対する答えです。それらに対するすべての答えは2017年に時代遅れであり、私を助けませんでした。私は10の評判を持っていないので、私は質問として自分の答えを書くことに決めました。どこにでもコメントを残すことができなければ、他に何をすべきですか? –

答えて

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()); 
} 
関連する問題