jiraatlassian-sourcetreejira-rest-apijira-pluginscriptrunner-for-jira

Remove a component from an issue in Jira


I would like to write code in order to remove a component from an issue. For example, there is a component called WF-EDA and I would like to write code in order to delete it. How can I do this? 

enter image description here


Solution

  •                     issueLinkManager.createIssueLink(newIssueCreatedID, myissueID, issueLinkType, sequence, authenticationContext.getLoggedInUser())
                        Collection<ProjectComponent>  componentList2=issue.getComponents()
                        log.warn("MOUNA CAMELIA COMPONENT LIST 2 "+ componentList2)
    
                        componentList2.removeAll(issue.getComponents())
                        log.warn("MOUNA CAMELIA COMPONENT LIST 2 "+ componentList2)
                        projectComponentManager.updateIssueProjectComponents( issue, componentList2)