How to associate an existing Component in Jira to an issue while creating the issue programatically using IssueInputParameters?
Hi @Dhruv Dixit ,
I believe you can use method setComponentIds(Long... componentIds).
Is it possible to share your code with me? Then I will be able to help you better.
Thank you.
Hi @Hana Kučerová
Can we map the issue to an existing Component using Components names?
Is there some method like setComponentNames(String componentNames)?
If yes, could you please share the link to the documentation for the method?
Or else, could we somehow get the name of the component from Component ID?
Thanks in advance!
there no such method like setCompontNames.
But you can get component using it's name and then obtain component id from the found object:
import com.atlassian.jira.bc.project.component.ProjectComponentimport com.atlassian.jira.bc.project.component.ProjectComponentManagerimport com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.MutableIssueimport com.atlassian.jira.project.ProjectMutableIssue issue = issueProject project = issue.getProjectObject()ProjectComponentManager projectComponentManager = ComponentAccessor.getProjectComponentManager()ProjectComponent component = projectComponentManager.findByComponentName(project.getId(), "Name")if (component) { Long componentId = component.getId() // continue ...}
If you please share your code, I can help you finish it.
Hi @Hana Kučerová ,
It has been solved by following your code.
Thanks for your help!
It looks like you're new here. Sign in or register to get started.