In order to update a custom field’s value, please follow these stesp
- Get an mutable issue object
- Get ‘ComponentManager’ object
- Get ‘CustomFieldManager’ object
- Get an custom field object with an custom field id (like 10106)
- Update custome field’s value
import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.fields.CustomField //Get an mutable issue object MutableIssue myIssue = issue issueKey = myIssue.getKey() //Get 'ComponentManager' Object componentManager = ComponentManager.getInstance() //Get 'CustomFieldManager' Object CustomFieldManager customFieldManager = componentManager.getCustomFieldManager() //Get Custom Field Object CustomField codeReview = customFieldManager.getCustomFieldObject(10106) //Update Custom field's value. myIssue.setCustomFieldValue(codeReview, issueKey) passesCondition = false
You can select custom field object with its name. But it’s better to use field id numeric value because it’s not changed after a custom field was created. With this feature, you can change field name .