Hello,
I'm trying to create a behaviour using Scriptrunner so that when creating a new issue within an epic, that the issue being created takes the epic's status and places it within a custom select list field.
I'm able to do most of this using the script provided within the documentation but I am having a hell of a time trying to get the Epic's status and passing it to the select list.
Any help would be greatly appreciated.
Here's the code I took from the docs but I cannot figure out how to get the Epic Link's custom field value for the life of me.
import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.*
if (getActionName() != "Create Issue") {
return // not the initial action, so don't set default values
}
//NEED TO GET THE Status of the Epic in the Epic Link field. no dice :(
// set a select list value -- also same for radio buttons
def faveFruitFld = getFieldByName("Phase (test)")
def optionsManager = ComponentAccessor.getOptionsManager()
def customField = customFieldManager.getCustomFieldObject(faveFruitFld.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
def optionToSelect = options.find { it.value == "In Development" }
faveFruitFld.setFormValue(optionToSelect.optionId)
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.