1
0
-1

In the external JIRA issue there is a component named “Backend”, in the internal Jira this component should be automatically changed to “API”, I tried to use the following


issue.components = replica.components
	.collect { remoteComponent ->
		nodeHelper.getComponent(
		if(remoteComponent.name == "Backend"){
			remoteComponent.name
		} else remoteComponent.name,
		nodeHelper.getProject(issue.projectKey)
		)
	}.findAll()


But it says I cannot call if in that context

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      To map components, this should work:


      def componentMap = ["Backend": "API"]
      issue.components = replica.components
         .collect { remoteComponent ->
              def componentName = remoteComponent.name
      		def localComponent = componentMap[componentName] ?: componentName
              nodeHelper.getComponent(
                  localComponent,
                  nodeHelper.getProject(issue.projectKey)
              ) 
          }.findAll() 



        CommentAdd your comment...