Researching various solutions, and drawing a blank.
I want to add a component to an issue as it is created (for why, see below, maybe there are two questions in one) and added a post function that executes the following
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
MutableIssue issue = issue
def projectComponentManager = ComponentAccessor.getProjectComponentManager()
def componentA = projectComponentManager.findByComponentNameCaseInSensitive('Jira Access Request')
issue.setComponent(componentA)
No errors are generated, yet the components field remains empty.
Any idea why this update is not being saved?
* As to the why
I want to assign an issue to a fixed user. I could add this user in each of the steps but then users have a habit of moving so don't want to edit the workflow each time. Opted for option to assign to Developer Lead (i.e. component lead or project lead if component not set). If user leaves they simply update the component lead. Any other suggestions?