Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×As the title says, I want to auto fill a defaule component when create a issue. Can JIRA or some plugin can do this? I have searched for some old questions about this title, the answers are all negative. Is there some more achievements?
Using a scriptrunner Behavior, I was able to assign a default component.
---
import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.*
// set Components
def projectComponentManager = ComponentAccessor.getProjectComponentManager()
def components = projectComponentManager.findAllForProject(issueContext.projectObject.id)
def component = getFieldById(COMPONENTS)
if (! component.getValue()) {
component.setFormValue(components.findAll { it.name in ["Component name from the list"] }*.id)
}
---
You can also assign multiple components by changing the ["Component name from the list"] to ["Component name from the list", "Other component name"]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Try this as post-function:
import com.atlassian.jira.component.ComponentAccessor
def projectComponentManager = ComponentAccessor.getProjectComponentManager()
projectComponentManager.findAllForProject(issue.projectObject.id)
def component = projectComponentManager.findByComponentName(issue.projectObject.id, "YOUR COMPONENT HERE")
issue.setComponent([component])
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 could try this, though it is not a perfect solution...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would also like to know if this is possible. Its seems that you can only set default values on custom fields.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register Now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.