So i'm trying to follow the prebuilt script for setting a system field defaults thats included in the adaptavist knowledge base (original located here). I'm trying to set the component, so I removed the Affects Versions and Assignee portion.
I've got it set up in the initializer and it seems to be giving me the green light, but nothing is being selected when I create an issue. Here's the exact script I'm using.
import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.*
if (getActionName() != "Create Issue") {
return
}
def projectComponentManager = ComponentAccessor.getProjectComponentManager()
def components = projectComponentManager.findAllForProject(issueContext.projectObject.id)
getFieldById(COMPONENTS).setFormValue(components.findAll { it.name in ["test1"] }*.id)
Note that I'm very new to scriptrunner and the JIRA API components so it could be something super simple I'm missing.
I did confirm the component exists with correct spelling as well.
Here's the screenshot of the setup, too.
