Hi Admins,
I need to edit Team advanced roadmap (plan) field on issues. But I can't get any options of it.
Does anyone know how to get team options and edit team field on postfunction?
Bests,
Deniz
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.context.IssueContextImpl
import com.atlassian.jira.issue.context.IssueContext
// Retrieve the current issue
def issue = issue as MutableIssue
// Define the custom field ID for the Team field
def teamFieldId = "customfield_12345"
// Access the custom field manager
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def teamField = customFieldManager.getCustomFieldObject(teamFieldId)
if (!teamField) {
log.error("Team custom field not found.")
return
}
// Use the issue's context to retrieve field configuration
def optionsManager = ComponentAccessor.getComponent(OptionsManager)
IssueContext issueContext = new IssueContextImpl(issue.getProjectObject(),
issue.getIssueTypeObject())
def fieldConfig = teamField.getRelevantConfig(issueContext)
// Retrieve and log all options in the Team field
def allOptions = optionsManager.getOptions(fieldConfig)
if (allOptions) {
log.debug("Available options in Team field:")
allOptions.each { option ->
log.debug("Option value: '${option.value}' (ID: ${option.optionId})") }
} else {
log.error("No options found for the Team field in the current issue context.") }
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.