Hi,
I am looking the way to get values selected in components on Transition/Edit screen and update it using script listener. Which Listener needs to select and how to write script. I needs this update as soon as someone select component on Edit screen or transition screen to show values in another db field to display user list based on above selected component.
Thanks in advance.
https://library.adaptavist.com/entity/update-the-value-of-a-custom-field-using-a-listener can give you the skeleton of a listener which is close to what you want to do.
You can use issue.getComponents() to get the list of components from the issue.
Hi!You can try this code:
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.event.type.EventDispatchOptionimport com.atlassian.jira.issue.Issueimport com.atlassian.jira.issue.IssueManagerimport com.atlassian.jira.issue.MutableIssueimport com.atlassian.jira.project.version.Versionimport com.atlassian.jira.bc.project.component.ProjectComponent
IssueManager issueManager = ComponentAccessor.getComponent(IssueManager.class)Issue updatedIssue = event.getIssue()
Collection <ProjectComponent> componentList = new ArrayList<ProjectComponent>()componentList = updatedIssue.getComponents()
Collection<Issue> subTasks = updatedIssue.getSubTaskObjects()subTasks.each {if (it instanceof MutableIssue) {((MutableIssue) it).setComponent(componentList)issueManager.updateIssue(event.getUser(), it, EventDispatchOption.ISSUE_UPDATED, false)}}
It looks like you're new here. Sign in or register to get started.