I need to use scriptrunner to create number of sub-task based on checkbox value. According to an example in Atlassian Answers, I copied following code in my script with some of my modification:
============================================================
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.customfields.option.LazyLoadedOption
// get checkboxes fields value
def subComponentFld = getFieldByName("Additional Access")
customField = customFieldManager.getCustomFieldObject(subComponentFld.getFieldId())
config = customField.getRelevantConfig(getIssueContext())
options = optionsManager.getOptions(config)
def optionsToSelect = options.findAll { it.value in ["Email Required", "Network Login Required", "SAP Access Required"] }
if (optionsToSelect ??? ) { }
==============================================================
Problem encountered:
1) scriptrunner cannot find matching method for "getFieldByName". Which extra library need to be imported?
2) I guess the value has been read into optionsToSelect , but how to check?
I am very new to JIRA script. Please help!
Thanks lots!!!!!!!!!!!