log = Category.getInstance("com.onresolve.jira.groovy.AutoCloseChildIssues");
def ComponentManager compoentManager = ComponentManager.getInstance();
def CustomFieldManager customFieldManager = compoentManager.getCustomFieldManager();
def CustomField deliverCycleField = customFieldManager.getCustomFieldObjectByName("customeTime");
def deliverCycleValue = issue.getCustomFieldValue(deliverCycleField);
def CustomField deliverCycleCountField = customFieldManager.getCustomFieldObjectByName("abc");
if (deliverCycleValue <= 16) {
issue.setCustomFieldValue(deliverCycleCountField, "aa");
} else {
issue.setCustomFieldValue(deliverCycleCountField, "bb");
log.error("-------------------------------------------5" + "deliverCycleValue=" + deliverCycleValue);
}
def FieldLayoutItem fieldLayoutItem = compoentManager.getFieldLayoutManager().getFieldLayout(issue).getFieldLayoutItem(deliverCycleCountField);
DefaultIssueChangeHolder defaultIssueChangeHolder = new DefaultIssueChangeHolder();
def modifiedFields = issue.getModifiedFields();
final ModifiedValue modifiedValue = (ModifiedValue) modifiedFields.get(deliverCycleCountField.getId());
deliverCycleCountField.updateValue(fieldLayoutItem, issue, modifiedValue, defaultIssueChangeHolder);
issue.getCustomFieldValue(deliverCycleField) method will return Option object so you need use condition something like, verfy this api before using
if (deliverCycleValue <= deliverCycleValue .name)
You need to pass Option object to the following method instead of 'aa'
issue.setCustomFieldValue(deliverCycleCountField, "aa");
check the following post to know how to get the option object
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.