script_fields
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| script_fields [2018/07/13 12:12] – Added testRadio change reference root | script_fields [2026/02/01 12:29] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 36: | Line 36: | ||
| </ | </ | ||
| - | ==== Return user that made last change | + | |
| + | ==== Drop Down Values based on Transitions | ||
| + | Create this as an initialiser. | ||
| <code java> | <code java> | ||
| import com.atlassian.jira.component.ComponentAccessor | import com.atlassian.jira.component.ComponentAccessor | ||
| import static com.atlassian.jira.issue.IssueFieldConstants.* | import static com.atlassian.jira.issue.IssueFieldConstants.* | ||
| - | def changedItem | + | def customFieldManager |
| + | def optionsManager = ComponentAccessor.getOptionsManager() | ||
| + | |||
| + | def formField = getFieldByName(" | ||
| + | def customField = customFieldManager.getCustomFieldObject(formField.getFieldId()) | ||
| + | def config = customField.getRelevantConfig(getIssueContext()) | ||
| + | def options = optionsManager.getOptions(config) | ||
| + | |||
| + | // Set the values inside the select list field | ||
| + | def noneMap = [" | ||
| + | |||
| + | |||
| + | if (getActionName() == "Need More Info") { | ||
| + | def optionsMap = noneMap + options.findAll { | ||
| + | | ||
| + | }.collectEntries { | ||
| + | [ | ||
| + | (it.optionId.toString()) : it.value | ||
| + | ] | ||
| + | } | ||
| + | formField.setFieldOptions(optionsMap) | ||
| + | } else if (getActionName() | ||
| + | def optionsMap = noneMap + options.findAll { | ||
| + | it.value in [" | ||
| + | | ||
| + | [ | ||
| + | (it.optionId.toString()) : it.value | ||
| + | ] | ||
| + | } | ||
| + | formField.setFieldOptions(optionsMap) | ||
| + | } else if (getActionName() == " | ||
| + | def optionsMap = noneMap + options.findAll { | ||
| + | it.value in [" | ||
| + | }.collectEntries { | ||
| + | [ | ||
| + | (it.optionId.toString()) : it.value | ||
| + | ] | ||
| + | } | ||
| + | formField.setFieldOptions(optionsMap) | ||
| + | } else { | ||
| + | def optionsMap = noneMap + options.findAll { | ||
| + | it.value in [" | ||
| + | }.collectEntries { | ||
| + | [ | ||
| + | (it.optionId.toString()) : it.value | ||
| + | ] | ||
| + | } | ||
| + | formField.setFieldOptions(optionsMap) | ||
| + | } | ||
| - | return " | ||
| </ | </ | ||
| - | Reference: [[https:// | + | References: |
| + | [[https:// | ||
| + | [[https:// | ||
| + | |||
script_fields.1531498362.txt.gz · Last modified: (external edit)
