Hello Community, I need help on scriptrunner, I need to set assignee based on the component's lead. Below is the code that I'm using
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.customfields.option.LazyLoadedOption
// a map with select list option to Component
def componentsMap = [
"BOSS" : "Component1",
"Mashery" : "Component2",
]
def issue = event.issue as MutableIssue
def selectList = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Affected Service")
def selectListValue = issue.getCustomFieldValue(selectList) as LazyLoadedOption
// there is no value for the select list - therefore do nothing
if (! selectListValue) {
return
}
def componentManager = ComponentAccessor.projectComponentManager
def componentName = componentsMap.get(selectListValue.value)
def component = componentManager.findByComponentName(issue.projectObject.id, componentName)
def userManager = ComponentAccessor.userManager
def components = issue.componentObjects.toList()
if (component) {
componentManager.updateIssueProjectComponents(issue, [component])
}
issue.setAssignee(ComponentAccessor.userManager.getUserByKey(component.lead))
In this code, I have Affected Service as a single select list, if BOSS has been selected, the Component Field will update and set to Component1, but the assignee remains unassigned even if I have default assignee on my component. I know that there's something wrong with my code because I'm a beginner. I need to change assignee everytime component field is changed, that's why I used script listener. Thanks
Hi,
Any update on this ?
Thanks,
Antoine
Hi Antoine,
As noted in the support ticket you submitted we already have a feature request ticket for this which you were added to. Please follow it here: https://productsupport.adaptavist.com/browse/SRJIRA-2563
Regards,
Katy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Katy,
This is not the same issue. This is about Insight only (not behaviours). We would like to have filters management on Insight the same way as on Jira =>
Best regards,
Antoine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Antoine,
Sorry about that. Someone from Insight should hopefully respond then. Insight is from Riada, not Adaptavist.
Regards,
Katy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are right sorry. I re-created the ticket in the Marketplace section.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Antoine,
This feature request is in our road map and will most likely be implemented this year.
Cheers //Mathias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please attach the link for it so that I can vote for it and follow it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.